FAQ Database Discussion Community


How to bind PreferenceFragment to back end?

android,android-preferences,preferencefragment
Is it possible to send requests when user changes settings on PreferenceFragment? I don't need SharedPreferences feature, I just need to sync PreferenceFragment with back end.

EditTextPreference with false persistent does not call onSharedPreferenceChanged

android,sharedpreferences,android-preferences
I've this EditTextPreference <EditTextPreference android:title="@string/settings_server" android:summary="@string/server_name_message" android:persistent="false" android:key="SERVER_NAME" /> But with persistent="false" it does not call onSharedPreferenceChanged method. How can I detect this event keeping android:persistent="false"...

Wrong Theme being applied to PreferenceActivity with xml reference

android,xml,reference,themes,android-preferences
I seem to have a problem implementing a theme onto a PreferenceActivity when i am using an XML reference to refer to said theme. I have 3 style.xml´s style.xml style.xml (v16) style.xml (v21) each of these in its appropriate values directory. To apply the theme, i reference it in my...

How do i change the look of my android preferences?

java,android,xml,android-preferences
Im having a couple of issues with my android preferences. Firstly i want a line divider/horizontal rule below my PreferenceCategory (Accounts), which in the preferences tutorial seems to automatically be placed under category headings, but in my case has not. Another issue is i would like to change the color...

Android Emulator issues with preference activity

java,android,android-fragments,android-emulator,android-preferences
I am facing an issue with Android Emulator, I have been already googling a bit about it but I cannot find a valid answer. I have a simple application in one activity, with swipe view (Fragments being swiped using android.support.v4.view.PagerTabStrip). This is ~ok except some weird swap emulation on API...

Exception when launching activity from PreferenceScreen

android,xamarin,monodroid,android-preferences
I'd like to launch an activity from a preference screen. This already did work in the past and I haven't changed any code but updated the Android SDK (updated packages and installed new ones) and since then it doesn't work anymore. I get an exception that the activity could not...

Show an only one dialog to write/set two EditTextPreferences

android,android-preferences
I'm creating a setting activity with an username and password. I use two editTextPreferences, they display their dialog independently one of the other. What I want is to have an only one dialog where I can write the username and the password in different editText but in the same dialog...

How to get a TextPreference's value from another activity?

android,android-activity,android-preferences
I have a TextPreference in my settings activity, and I would like to get the changing value from that from another activity. The startActivityForResult() method can help ? preference xml : <EditTextPreference android:key="@string/pref_location_key" android:title="@string/pref_location_label" android:defaultValue="@string/pref_location_default" android:inputType="text" android:singleLine="true" /> ...

PreferenceFragment not saving values - with test case and screenshot

android,android-fragments,sharedpreferences,android-preferences,android-settings
I have prepared a simple test case at GitHub for my question and have a feeling, that only few lines of code are missing to make it working. In an Android app I have 1 activity (MainActivity.java) and 2 fragments (MainFragment.java and PrefFragment.java) - and when I change values in...

PreferenceFragment and backstack with getSupportFragmentManager()

android,android-fragments,android-preferences
I started to change my App to Material design. I´ve changed my Activity to ActionBarActivity and My Theme to AppCompat, to be able to color ActionBar and use AppCompat Navigation drawer. I´m switching Fragments in my Activity, which are added to backstack throught getSupportFragmentManager() .beginTransaction() .replace(...) .addToBackStack(null) .commit(); I have...

Custom NumberPickerPreference - how to set the NumberPicker value?

android,sharedpreferences,android-preferences,android-dialog,numberpicker
I have prepared a simple test case for my problem at GitHub. I have extended a DialogPreference to a custom NumberPickerPreference - and it works well: displays a NumberPicker in a dialog and saves integer value when the dialog is closed. My problem is that the saved integer value is...

Saving texture with Preferences

android,libgdx,android-preferences,object-object-mapping
So what Im trying to achive is: When the user purchases a new item (a texture) they can click a button to replace the old Item(texture) with the new one. What got in my mind first was Objectmaps. So I created this: ObjectMap<Integer, Texture> screenMap = new ObjectMap<Integer, Texture>(); Im...

Using ListPreference in AndroidStudio

android,android-activity,android-studio,android-preferences
I have a settings menu with a list preference from the sample settings activity in Android Studio. <ListPreference android:key="example_list" android:title="@string/pref_title_add_friends_to_messages" android:defaultValue="5" android:entries="@array/pref_example_list_titles" android:entryValues="@array/pref_example_list_values" android:negativeButtonText="@null" android:positiveButtonText="@null" /> In this list preference you can select 8 different things. <string...

PreferenceScreen crashes

android,eclipse,android-preferences
I made a PreferenceScreen using res/xml/preferences.xml <?xml version="1.0" encoding="utf-8"?> <preferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <preferencecategory android:title="@string/pref_lang_setting"> <listpreference android:key="preflang" android:entries="@array/lang_select_array" android:summary="@string/pref_lang_summary" android:title="@string/pref_lang" android:entryValues="@array/lang_select_Values" > </listpreference> </preferencecategory>...

Add ActionBar to a PreferenceActivity

java,android,android-activity,android-actionbar,android-preferences
I am trying to make a Settings Activity using a PreferenceActivity. The problem is that the ActionBar won't show up no matter what I do. I've tried getSupportActionBar, getActionBar, setActionBar. Nothing works. I see other apps settings with ActionBars. Do they not use PreferenceActivity?...

Android Settings : How to use SharedPreferences in a SettingsFragment?

android,sharedpreferences,settings,android-preferences
I am using my own SharedPreferences in a normal Activity with a custom layout with two checkboxes and seekbars. Now I want to make a proper SettingsActivity/SettingsFragment with these settings. Is there a way to use my custom SharedPreference instead of the PreferenceManager and the default preference file? My own...

PreferenceFragment is not added to Activity as expected

android,android-fragments,android-preferences,preferencefragment
I'm trying to implement PreferenceFragment according to the API in the Google docs, copying and pasting. Now here it says: You can then add this fragment to an Activity just as you would for any other Fragment. However, there is a compile-time arror at this line: // Display the fragment...

ListPreference throws NullPointerException

java,android,android-preferences
I have a ListPreference: <ListPreference android:entries="@array/frequencies" android:entryValues="@array/frequencies_values" android:key="pref_key_frequencies" android:summary="@string/frequency_pref_summary" android:title="@string/frequency_pref_title" /> @array/frequencies: <string-array name="frequencies"> <item>5 minutes</item> <item>10 minutes</item> <item>15 minutes</item> <item>20 minutes</item> <item>30 minutes</item> <item>60...

OnSharedPreferenceChangeListener callback is never executed

android,sharedpreferences,android-preferences
I've my main activity that starts a new activity (SearchResultsActivity). I also have a settings menu. I want my SearchResultsActivity to be notified every time there is a new/edited setting from the settings menu. I'm implementing the OnSharedPreferenceChangeListener the interface on SearchResultsActivity and registering itself to listen to any modification...

why sharedpreference commit method doesn't work in my overrided method?

android,sharedpreferences,android-preferences,preferenceactivity
i have a splashscreen activity in my app that checks to find out app first run and show user interface language selecting dialog in first run then try to store it in preferences but my code doesn't work. i want to save this in a key that exist in my...

Custom inline SeekBarPreference - how to set SeekBar progress on the 1st run?

android,android-preferences,seekbar,android-seekbar,seekbarpreference
I have prepared a simple test project for my question at GitHub. In my project there is a custom inline SeekBarPreference, which mostly works fine (its summary is updated when seekbar is being dragged and it saves integer value): However there is a problem: On the very 1st run of...