Android Programming Press on the image to return to the main documentation page.

PreferenceActivity

PreferenceActivity library allows you to show the standard settings interface and provides an easy way to handle applications settings.
This library requires you to modify AndroidManifest.xml. See the
tutorial for more information.

List of types:

PreferenceCategory
PreferenceManager
PreferenceScreen

PreferenceCategory

PreferenceCategory holds a group of other preferences.

Events:

None

Members:


  AddCheckBox (Key As String, Title As String, Summary As String, DefaultValue As Boolean)

  AddEditText (Key As String, Title As String, Summary As String, DefaultValue As String)

  AddList (Key As String, Title As String, Summary As String, DefaultValue As String, Values As List)

  AddPreferenceCategory (PreferenceCategory As PreferenceCategory)

  AddPreferenceScreen (PreferenceScreen As PreferenceScreen)

  CreateIntent As android.content.Intent

  Initialize (Title As String)

Members description:

AddCheckBox (Key As String, Title As String, Summary As String, DefaultValue As Boolean)
Adds a preference entry with a check box. The entry values can be either True or False.
Key - The preference key associated with the value.
Title - Entry title.
Summary - Entry summary (second row).
DefaultValue - The default value of this preference entry if the key does not already exist.
AddEditText (Key As String, Title As String, Summary As String, DefaultValue As String)
Adds a preference entry which allows the user to enter free text.
Key - The preference key associated with the value.
Title - Entry title.
Summary - Entry summary (second row).
DefaultValue - The default value of this preference entry if the key does not already exist.
AddList (Key As String, Title As String, Summary As String, DefaultValue As String, Values As List)
Adds a preference entry which allows the user to choose a single item out of a list.
Key - The preference key associated with the value.
Title - Entry title.
Summary - Entry summary (second row).
DefaultValue - The default value of this preference entry if the key does not already exist. Should match one of the values.
Values - A list of strings with the possible values.
AddPreferenceCategory (PreferenceCategory As PreferenceCategory)
Adds a PreferenceCategory. A preference category is made of a title and a group of entries.
Note that a PreferenceCategory cannot hold other PreferenceCategories.
AddPreferenceScreen (PreferenceScreen As PreferenceScreen)
Adds a secondary PreferenceScreen. When the user presses on this entry the second screen will appear.
CreateIntent As android.content.Intent
Creates the Intent object that is required for showing the PreferencesActivity.
Example:StartActivity(PreferenceScreen1.CreateIntent)
Initialize (Title As String)
Initializes the object and sets the category title.

PreferenceManager

Provides access to the saved settings. Using PreferenceManager you can get the stored values and modify them.

Events:

None

Members:


  ClearAll

  GetAll As Map

  GetBoolean (Key As String) As Boolean

  GetString (Key As String) As String

  GetUpdatedKeys As List

  SetBoolean (Key As String, Value As Boolean)

  SetString (Key As String, Value As String)

Members description:

ClearAll
Clears all stored entries.
GetAll As Map
Returns a Map with all the Keys and Values. Note that changes to this map will not affect the stored values.
GetBoolean (Key As String) As Boolean
Returns the Boolean value mapped to the given key. Returns False is the key is not found.
GetString (Key As String) As String
Returns the String value mapped to the given key. Returns an empty string if the key is not found.
GetUpdatedKeys As List
Returns a list with the keys that were updated since the last call to GetUpdatedKeys.
Note that the updated keys may include keys with unchanged values.
SetBoolean (Key As String, Value As Boolean)
Maps the given key to the given Boolean value.
SetString (Key As String, Value As String)
Maps the given key to the given String value.

PreferenceScreen


Events:

None

Members:


  AddCheckBox (Key As String, Title As String, Summary As String, DefaultValue As Boolean)

  AddEditText (Key As String, Title As String, Summary As String, DefaultValue As String)

  AddList (Key As String, Title As String, Summary As String, DefaultValue As String, Values As List)

  AddPreferenceCategory (PreferenceCategory As PreferenceCategory)

  AddPreferenceScreen (PreferenceScreen As PreferenceScreen)

  CreateIntent As android.content.Intent

  Initialize (Title As String, Summary As String)

Members description:

AddCheckBox (Key As String, Title As String, Summary As String, DefaultValue As Boolean)
Adds a preference entry with a check box. The entry values can be either True or False.
Key - The preference key associated with the value.
Title - Entry title.
Summary - Entry summary (second row).
DefaultValue - The default value of this preference entry if the key does not already exist.
AddEditText (Key As String, Title As String, Summary As String, DefaultValue As String)
Adds a preference entry which allows the user to enter free text.
Key - The preference key associated with the value.
Title - Entry title.
Summary - Entry summary (second row).
DefaultValue - The default value of this preference entry if the key does not already exist.
AddList (Key As String, Title As String, Summary As String, DefaultValue As String, Values As List)
Adds a preference entry which allows the user to choose a single item out of a list.
Key - The preference key associated with the value.
Title - Entry title.
Summary - Entry summary (second row).
DefaultValue - The default value of this preference entry if the key does not already exist. Should match one of the values.
Values - A list of strings with the possible values.
AddPreferenceCategory (PreferenceCategory As PreferenceCategory)
Adds a PreferenceCategory. A preference category is made of a title and a group of entries.
Note that a PreferenceCategory cannot hold other PreferenceCategories.
AddPreferenceScreen (PreferenceScreen As PreferenceScreen)
Adds a secondary PreferenceScreen. When the user presses on this entry the second screen will appear.
CreateIntent As android.content.Intent
Creates the Intent object that is required for showing the PreferencesActivity.
Example:StartActivity(PreferenceScreen1.CreateIntent)
Initialize (Title As String, Summary As String)
Initializes the object and sets the title that will show. The summary will show for secondary PreferenceScreens.
Top