Android Guides | Samples

Android.Content.Res.Resources.GetQuantityString Method

Returns the string necessary for grammatically correct pluralization of the given resource ID for the given quantity.

Syntax

[Android.Runtime.Register("getQuantityString", "(II)Ljava/lang/String;", "GetGetQuantityString_IIHandler")]
public virtual String GetQuantityString (Int32 id, Int32 quantity)

Parameters

id
The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
quantity
The number used to get the correct string for the current language's plural rules.

Exceptions

TypeReason
!:NoType:android/content/res/Resources$NotFoundException;Href=../../../../reference/android/content/res/Resources.NotFoundException.htmlThrows NotFoundException if the given ID does not exist.

Remarks

Returns the string necessary for grammatically correct pluralization of the given resource ID for the given quantity. Note that the string is selected based solely on grammatical necessity, and that such rules differ between languages. Do not assume you know which string will be returned for a given quantity. See String Resources for more detail.

[Android Documentation]

Requirements

Namespace: Android.Content.Res
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1