Android Resources suggest change

Define String Plurals

To differentiate between plural and singular strings, you can define a plural in your strings.xml file and list the different quantities, as shown in the example below:

<?xml version="1.0" encoding="utf-8"?>
    <plurals name="hello_people">
        <item quantity="one">Hello to %d person</item>
        <item quantity="other">Hello to %d people</item>

This definition can be accessed from Java code by using the getQuantityString() method of the Resources class, as shown in the following example:

getResources().getQuantityString(R.plurals.hello_people, 3, 3);

Here, the first parameter R.plurals.hello_people is the resource name. The second parameter (3 in this example) is used to pick the correct quantity string. The third parameter (also 3 in this example) is the format argument that will be used for substituting the format specifier %d.

Possible quantity values (listed in alphabetical order) are:


It is important to note that not all locales support every denomination of quantity. For example, the Chinese language does not have a concept of one item. English does not have a zero item, as it is grammatically the same as other. Unsupported instances of quantity will be flagged by the IDE as Lint warnings, but won’t cause complication errors if they are used.

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents
9 Resources
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close