You are able to define many different grammatical forms for a particular word. To define more than one quantity form of a given word in your string resource file, you simply specify more than one <item> element and provide a value for the quantity attribute for that particular <item> denoting the word’s quantity.
Subscribe to view the full document.
Working with Quantity Strings (Cont’d)ValueDescriptionzeroUsed for languages that have words with a zero quantityform.oneUsed for languages that have words with a singular quantityform.twoUsed for languages that have words for specifying two.fewUsed for languages that have words for specifying a small quantitybatch.manyUsed for languages that have words for specifying a large quantity batch.otherUsed for languages that have words that do not have a quantity form.
Working with String ArraysYou can specify lists of strings in resource files.–This is a good way to store menu options and drop-down list values.–String arrays are defined in XML under the res/values/project directory.–They are compiled into the application package at build time.String arrays are appropriately tagged with the <string-array>tag.–They usually include a number of <item>child tags, one for each string in the array.
Subscribe to view the full document.
Working with String Arrays (Cont’d)<?xml version="1.0" encoding="utf-8"?><resources><string-array name="flavors"><item>Vanilla</item><item>Chocolate</item><item>Strawberry</item><item>Coffee</item><item>Sherbet</item></string-array><string-array name="soups"><item>Vegetable minestrone</item><item>New England clam chowder</item><item>Organic chicken noodle</item></string-array></resources>
Working with String Arrays (Cont’d)Accessing string array resources is easy.The method getStringArray()retrieves a string array from a resource file, in this case one named flavors:String[] aFlavors = getResources().getStringArray(R.array.flavors);