Questions tagged [preferenceactivity]

PreferenceActivity in Android is a base class for an activity to show a hierarchy of preferences to the user

680 questions
32
votes
10 answers

How do you refresh PreferenceActivity to show changes in the settings?

Based on the following code, can you tell me how to refresh the PreferenceActivity window to show changes in the settings immediately? For example: the user taps the master chime toggle checkbox to true (ticked), I would like the user to immediately…
Emad-ud-deen
  • 4,322
  • 19
  • 78
  • 146
28
votes
2 answers

Why won't Fragment retain state when screen is rotated?

I've been having some trouble getting some custom DialogPreference subclasses inside a PreferenceFragment to remain visible when the screen is rotated. I don't experience this problem when using a PreferenceActivity, so I don't know whether it's an…
25
votes
1 answer

Action Bar Home Button not functional with nested PreferenceScreen

I found a workaround to actually enable the ActionBar home button on the nested PreferenceScreen... however it doesn't call OnOptionsItemSelected in my PreferenceActivity. Anyone know a way to actually use the home button on a nested…
25
votes
4 answers

Skip the headers in PreferenceActivity when there's only one header

I added preference-headers to my app so that the preference screen would not look broken on Honeycomb and tablet sized ICS. However, I only have one header at the moment so you have to click through a header screen with only one entry on phone sized…
Freaky Dug
  • 876
  • 10
  • 11
24
votes
4 answers

getActionBar() returns null in PreferenceActivity (AppCompat-v7 21)

I have implemented DoneBar (two buttons in actionbar) in PreferenceActivity as provided in v20 sdk samples, but after updating SDK and AppCompat to version 21 my app crashes at java.lang.NullPointerException: Attempt to invoke virtual method 'void…
Olegas Gončarovas
  • 1,317
  • 1
  • 10
  • 16
23
votes
5 answers

MultiSelectListPreference example

I am having a hard time trying to find a good example of the MultiSelectListPreference provided in the Android API. I have seen many references to this blog, and tho this is the end result I desire, I don't want to create a class for each…
mohbandy
  • 281
  • 1
  • 2
  • 8
21
votes
3 answers

Setting default values of multiple SharedPreferences instances/files

Suppose that I have an application which saves preferences onto two files, preferences1.xml and preferences2.xml. Then, I can retrieve references to the corresponding objects with the following code: SharedPreferences sharedPrefs1 =…
19
votes
2 answers

Android - DataBinding with Preference activity

I set up the data binding in xml but when i go to the preference activity to actually set up the binding i cant. The file where the data binding xml is in is called preference.xml so i assume there should be a generated class called…
j2emanue
  • 51,417
  • 46
  • 239
  • 380
18
votes
7 answers

How to add ToolBar in PreferenceActivity?

I want to add ToolBar in PreferenceActivity in my android application. I wrote the following code. public class SettingsActivity extends PreferenceActivity { SendSMS sms; protected void onCreate(Bundle savedInstanceState) { …
Tek Raj
  • 313
  • 1
  • 3
  • 8
18
votes
8 answers

Keep the actionbar displayed in when changing PreferenceScreen

I'm trying to display a actionbar in my preference screen. In order to do so I added the following code in my SettingActivity public class PreferencesActivity extends ActionBarActivity { @Override protected void onCreate(Bundle…
18
votes
7 answers

Preference Activity on Preference Click Listener

I am building a Preference Activity where most of the preferences in the list will be executing code and not modifying a SharedPreference directly. My preferences.xml file looks like this.
BarryBostwick
  • 859
  • 1
  • 11
  • 20
18
votes
5 answers

Android- deprecated method warning regarding PreferenceActivity

When I attempt to follow Android's Developer guides and tutorials for creating a Settings Activity using Preferences, I receive warnings such as: "The method addPreferencesFromResource(int) from the type PreferenceActivity is deprecated" for both of…
17
votes
1 answer

DialogFragment in PreferenceActivity

I have defined dialogfragments (because Android documentation says that it is better and indeed it is) but now I want to use it in PreferenceActivity. The problem is that I cannot use getSupportFragmentManager() there and I cannot use…
Matroska
  • 6,705
  • 12
  • 59
  • 96
16
votes
3 answers

android - How to set custom layout for PreferenceActivity in Android 3.0?

I am developing app with minSdkVersion="11", that is app for tablets and Android 4.0 and newer. I have scrutinized internet on this topic, but have not found much. To implement custom layout for previous versions of Android SDK we just have to…
morphium
  • 676
  • 1
  • 6
  • 13
16
votes
1 answer

Get the Ringtone title from RingtonePreference

I have a RingtonePreference that is used to select a ringtone that is broadcasted to a receiver used in an Alarm application. I would like to display the title (the titles displayed in the list you see when you choose the ringtone) of the selected…
Alex Bergsland
  • 215
  • 2
  • 8
1
2
3
45 46