AbstractPreferences.GetInt(String, Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Implements the getInt
method as per the specification in
Preferences#getInt(String,int)
.
[Android.Runtime.Register("getInt", "(Ljava/lang/String;I)I", "GetGetInt_Ljava_lang_String_IHandler")]
public override int GetInt (string? key, int def);
[<Android.Runtime.Register("getInt", "(Ljava/lang/String;I)I", "GetGetInt_Ljava_lang_String_IHandler")>]
override this.GetInt : string * int -> int
Parameters
- key
- String
key whose associated value is to be returned as an int.
- def
- Int32
the value to be returned in the event that this
preference node has no value associated with key
or the associated value cannot be interpreted as an int.
Returns
the int value represented by the string associated with
key
in this preference node, or def
if the
associated value does not exist or cannot be interpreted as
an int.
- Attributes
Remarks
Implements the getInt
method as per the specification in Preferences#getInt(String,int)
.
This implementation invokes #get(String,String) <tt>get(key, null)</tt>
. If the return value is non-null, the implementation attempts to translate it to an int
with Integer#parseInt(String)
. If the attempt succeeds, the return value is returned by this method. Otherwise, def
is returned.
Java documentation for java.util.prefs.AbstractPreferences.getInt(java.lang.String, int)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.