android - Getting a String from Plurals to use in XML? -


i using plurals simplify code. e.g., used have

<string name="cat">cat</string> <string name="cats">cats</string> 

using plurals instead of multiple strings, have

<plurals name="cats">     <item quantity="one">cat</item>     <item quantity="other">cats</item> </plurals> 

however, used retrieve strings use titles or summaries in xml. e.g.,

android:title="@string/cats" 

having removed string in favor of plural, unsure how retrieve string xml. did make naive attempt with

android:title="@plurals/cats" 

but gives me @1234567890 instead of cats (or cat).

anyone know if possible retrieve string out of plural xml?

you have set code:

...settext(yourcontext.getresources().getquantitystring(r.plurals.cats, catscountvar)); 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -