Reputation: 2078
I know that Android has the ability to create an Activity for updating shared preferences, but is there a way to display that "Activity" in an alert dialog so that the preferences can appear as a "popup" instead of switching out to its own activity?
I hope this makes sense....
Upvotes: 2
Views: 3233
Reputation: 48871
I've never tried it with a PreferencesActivity, but you can make a normal Activity appear as a popup dialog using android:theme="@android:style/Theme.Dialog"
in your AndroidManifest.xml example
<activity
android:name=".MyPrefsActivity"
android:label=""
android:theme="@android:style/Theme.Dialog">
</activity>
As I said, not sure if it'll work with a PreferencesActivity.
Upvotes: 7
Reputation: 6081
It is possible to use an alert dialog to manage some of your preferences. But I would only recommend this if you only have to set one little preference.
Because you'll have to store and load the preferences yourself, a PreferenceActivity would do this automatically for you.
The resources you need to accomplish this is the AlertDialog page and an introduction to Shared Preferences
Then simply listen for onClick()
in the alert dialog and set your preference.
Upvotes: 1