Android resource for a specific product

感情迁移 提交于 2019-11-30 08:53:28
nandeesh
  1. from where at runtime the system load the correct string resource ?

The system does not load this at runtime. The correct string resource is preloaded according to PRODUCT_CHARACTERISTICS defined for a specific target build. So you cannot use this while building from eclipse. This is used only for building apps preloaded on platform.

2 . What must I do to add a new product? e.g.

You need to add to PRODUCT_CHARACTERISTICS in device.mk file

Answer for your question 1.
You can get them via

String mystring = getResources().getString(R.string.mystring);

But your strings.xml should something like this

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="tablet" >About tablet</string>
    <string name="default" >About phone</string>
 </resources>

Answer for your question 2.
How will that work, because that is a resource file. If you want you can either create a file and save the information in it. Locally. But it will be only on that device.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!