Hi Greg,
To use plurals. You declare it like this in your strings.xml.
<plurals name="thing_string">
<item quantity="one">%s thing</item>
<item quantity="other">@s things</item>
</plurals>
Hope this helps.
On Mar 11, 10:26 am, Greg <[email protected]> wrote:
> Hi,
> I am used to just using a choice format for doing something deciding
> between "{0} thing" and "{0} things".
>
> However Context and Resources have a lot of utitilities it seems for
> dealing with String and loading them with native replacement. One
> method of such is Resources.getQuantityText(int id, int quantity) ...
> problem is the way to declare the string is not declared anywhere and
> upon using this method I am greeted with
>
> android.content.res.Resources$NotFoundException: Plural resource ID
> #0x7f080050 quantity=450 item=other
>
> Looking at the source it does use a native method to load the
> pluralized resource so I can't look at the code. Would anyone know how
> to use this may-be pretty nifty utility?
>
> I was thinking it might be something like:
>
> <string name="thing_string" pluralrule="one">%1$d thing</string>
> <string name="thing_string" pluralrule="other">%1$d things</string>
>
> since they don't use the xml id element but I am just guessing and am
> completely stumped.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en