I\'ve been attempting to utilize the plurals resource with Android but have not had any luck.
Here is my resource file for my plurals:
Android "supports" the use of plurals by use of R.plurals which is practically undocumented. Diving into the source code reveals that you should be able to have the following possible versions of a string:
However, I've found that only "one" and "other" actually work (despite the others being used in the android source!).
To use plurals you want to declare you pluralizable strings in a similar way to normal string resources:
- 1 match
- %d matches
Then to actually use them in code, use code similar to what superfell suggested above:
String text = getResources().getQuantityString(R.plurals.match, myIntValue, myIntValue);
myTextView.setText(text);