Snippet: Android Plurals form

Android supports Plurals . Plurals are XML based resources which allow to handle different quantities. Here you can find a simple implemetation. Plurals can be placed in any xml-file in the values directory, but usually, it will be placed in strings.xml. No books One book Two books Few books Many books %d books To get the plurals from code, you can use the getQuantityString(int id, int quantity) . Resources res = getResources(); String book = res.getQuantityString(R.plurals.books, count, count); The call to getQuantityString() takes the id of the plural, the quantity used to select the appropriate plural, and optionally any arguments used for substitution in the display string. If your plural strings do not include string formatting, you don't need to pass the third parameter. Here a simple code: public class PluralFormsActivity extends SherlockActivity { private void retrivePlurals() { TextView tw = (TextView) findViewById(R.id.t...