i got this code from Settings app...
<string name="about_settings" product="tablet">About tablet</string>
<string name="about_settings" product="default">About phone</string>
then my questions are:
What must I do to add a new product? e.g.
<string name="about_settings" product="laptop">About laptop</string>
Overview. In Android, almost everything is a resource. Defining resources that you can then access in your app is an essential part of Android development. Resources are used for anything from defining colors, images, layouts, menus, and string values. The value of this is that nothing is hardcoded.
Resource Manager is a tool window for importing, creating, managing, and using resources in your app. You can open the tool window by selecting View > Tool Windows > Resource Manager from the menu bar or by selecting Resource Manager on the left side bar. Click Add to add a new resource to your project.
XML tags define the data and used to store and organize data. It's easily scalable and simple to develop. In Android, the XML is used to implement UI-related data, and it's a lightweight markup language that doesn't make layout heavy. XML only contains tags, while implementing they need to be just invoked.
- 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With