java.lang.Object | ||
↳ | android.preference.Preference | |
↳ | android.preference.RingtonePreference |
A
Preference
that allows the user to choose a ringtone from those on the device.
The chosen ringtone's URI will be persisted as a string.
If the user chooses the "Default" item, the saved string will be one of
DEFAULT_RINGTONE_URI
,
DEFAULT_NOTIFICATION_URI
, or
DEFAULT_ALARM_ALERT_URI
. If the user chooses the "Silent"
item, the saved string will be an empty string.
XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|||||||||
android:ringtoneType | Which ringtone type(s) to show in the picker. | ||||||||||
android:showDefault | Whether to show an item for a default sound. | ||||||||||
android:showSilent | Whether to show an item for 'Silent'. |
[Expand]
Inherited XML Attributes
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.preference.Preference
|
[Expand]
Inherited Constants
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.preference.Preference
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
|
||||||||||
|
|
||||||||||
|
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Returns the sound type(s) that are shown in the picker.
|
||||||||||
|
Returns whether to a show an item for the default sound/ringtone.
|
||||||||||
|
Returns whether to a show an item for 'Silent'.
|
||||||||||
|
See Activity's onActivityResult.
|
||||||||||
|
Sets the sound type(s) that are shown in the picker.
|
||||||||||
|
Sets whether to show an item for the default sound/ringtone.
|
||||||||||
|
Sets whether to show an item for 'Silent'.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Called when this Preference has been attached to a Preference hierarchy.
|
||||||||||
|
Processes a click on the preference.
|
||||||||||
|
Called when a Preference is being inflated and the default value
attribute needs to be read.
|
||||||||||
|
Prepares the intent to launch the ringtone picker.
|
||||||||||
|
Called when the chooser is about to be shown and the current ringtone
should be marked.
|
||||||||||
|
Called when a ringtone is chosen.
|
||||||||||
|
Implement this to set the initial value of the Preference.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.preference.Preference
|
|||||||||||
From class
java.lang.Object
|
|||||||||||
From interface
android.preference.PreferenceManager.OnActivityResultListener
|
|||||||||||
From interface
java.lang.Comparable
|
Which ringtone type(s) to show in the picker.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
ringtone
|
1 | Ringtones. |
notification
|
2 | Notification sounds. |
alarm
|
4 | Alarm sounds. |
all
|
7 | All available ringtone sounds. |
This corresponds to the global attribute
resource symbol
ringtoneType
.
Whether to show an item for a default sound.
Must be a boolean value, either "
true
" or "
false
".
This may also be a reference to a resource (in the form
"
@[
package
:]
type
:
name
") or
theme attribute (in the form
"
?[
package
:][
type
:]
name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol
showDefault
.
Whether to show an item for 'Silent'.
Must be a boolean value, either "
true
" or "
false
".
This may also be a reference to a resource (in the form
"
@[
package
:]
type
:
name
") or
theme attribute (in the form
"
?[
package
:][
type
:]
name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol
showSilent
.
Returns the sound type(s) that are shown in the picker.
Returns whether to a show an item for the default sound/ringtone.
Returns whether to a show an item for 'Silent'.
See Activity's onActivityResult.
Sets the sound type(s) that are shown in the picker.
type | The sound type(s) that are shown in the picker. |
---|
Sets whether to show an item for the default sound/ringtone. The default to use will be deduced from the sound type(s) being shown.
showDefault | Whether to show the default or not. |
---|
Sets whether to show an item for 'Silent'.
showSilent | Whether to show 'Silent'. |
---|
Called when this Preference has been attached to a Preference hierarchy. Make sure to call the super implementation.
preferenceManager | The PreferenceManager of the hierarchy. |
---|
Processes a click on the preference. This includes saving the value to
the
SharedPreferences
. However, the overridden method should
call
callChangeListener(Object)
to make sure the client wants to
update the preference's state with the new value.
Called when a Preference is being inflated and the default value attribute needs to be read. Since different Preference types have different value types, the subclass should get and return the default value which will be its value type.
For example, if the value type is String, the body of the method would
proxy to
getString(int)
.
a | The set of attributes. |
---|---|
index | The index of the default value attribute. |
Prepares the intent to launch the ringtone picker. This can be modified to adjust the parameters of the ringtone picker.
ringtonePickerIntent | The ringtone picker intent that can be modified by putting extras. |
---|
Called when the chooser is about to be shown and the current ringtone should be marked. Can return null to not mark any ringtone.
By default, this restores the previous ringtone URI from the persistent storage.
Called when a ringtone is chosen.
By default, this saves the ringtone URI to the persistent storage as a string.
ringtoneUri |
The chosen ringtone's
Uri
. Can be null.
|
---|
Implement this to set the initial value of the Preference.
If
restorePersistedValue
is true, you should restore the
Preference value from the
SharedPreferences
. If
restorePersistedValue
is false, you should set the Preference
value to defaultValue that is given (and possibly store to SharedPreferences
if
shouldPersist()
is true).
This may not always be called. One example is if it should not persist but there is no default value given.
restorePersistedValue | True to restore the persisted value; false to use the given defaultValue . |
---|---|
defaultValueObj | The default value for this Preference. Only use this if restorePersistedValue is false. |