android-preferences

Get event on dialog( Ok ,Cancel) button pressed(Android)

霸气de小男生 提交于 2019-12-11 04:45:47
问题 In my Android application I am displaying the dialogbox which contains edittext . This dialogbox is displayed using PreferenceCategory .My xml file looks like <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > <PreferenceCategory android:title="@string/security_setting_edittext_hint" > <EditTextPreference android:dialogTitle="@string/security_setting_button" android:key="set_password_preference" android:summary="@string/set_password_summary" android:title="@string

How to create a Listener to Preferences changes in Preferences activity?

冷暖自知 提交于 2019-12-11 04:44:45
问题 I have Preferences activity in my app that has ListPreference so the user can choose language for the app. The app displays the new language just after the user close the Preferences activity. I want to create a listener to the ListPreference so the app will restart when the Listener is triggers (just after the user choose a language/choose item from the ListPreference). How can I do that? SettingsActivity: public class SettingsActivity extends AppCompatPreferenceActivity { /** * A preference

How to remove the title bar from PreferenceCategory in PreferenceActivity

拈花ヽ惹草 提交于 2019-12-11 04:17:12
问题 This is my preferences xml file: myPreferences.xml: <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceCategory> <EditTextPreference android:key="name" android:title="Name" android:inputType="text" android:defaultValue="" /> <EditTextPreference android:key="email" android:title="Email" android:inputType="textEmailAddress" android:defaultValue="" /> <EditTextPreference android:key="phone" android:title="Phone Number"

PreferenceActivity error: doesn't show selected option after close Activity

六眼飞鱼酱① 提交于 2019-12-11 03:57:23
问题 The value is saved well in SharedPreference when i push it , but it doesn't show when i open another time the PreferenceActivity. It runs if i don't put the android:entryValues , but i can't use it cause there is some difference using distinct languages in order to see what's the value of the prefference. ¿Any idea of what can i do? Thanks for reading. code: the PreferencesMenu activity : public class PreferencesMenu extends PreferenceActivity { @Override public void onCreate(Bundle

Individual Preferences for each item in a ListView?

自作多情 提交于 2019-12-11 02:34:23
问题 I'm creating my first android app (or attempting to anyway) and i have a question i can't seem to find the answer to. I would like to allow users to enter a separate set of preferences for each item in a list view. I have the PreferenceScreen working, but it maintains the same preferences for every item (i.e. changing 1 item results in changes to all others as well). To give a more detailed example: Say i have a list of cars: * Car 1 * Car 2 * Etc... I would like to be able to click on "Car 1

Ionic 2 Cordova and Typescript (App Preferences plugin)

空扰寡人 提交于 2019-12-11 02:25:26
问题 I am working on Ionic 2 application with Typescript. For setting up preferences I wish to use the cordova plugin https://github.com/chrisekelley/AppPreferences/. There are a few things I am strugling with. After a lot of googling there are a few things that I am not yet able to figure out. It would be great If anyone can help. Using the above Cordova Plugin with Ionic 2. There are a few posts on the internet which got me to where I am currently. But most of them refer to javascript so dont

Preference Fragment with android.support.v4.app.Fragment

爷,独闯天下 提交于 2019-12-11 01:35:51
问题 How to use preference fragment with android.support.v4.app.Fragment? I tried to use android.preference.PreferenceFragment but I got an error: Wrong 2nd argument type/ FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.replace(R.id.fragment_container, new SettingsFragment()); transaction.addToBackStack(null); transaction.commit(); SettingsFragment is the preference fragment What can solve this problem? 回答1: By my knowledge PreferenceFragment is not supported

Does SharedPreferences use a certain character set?

廉价感情. 提交于 2019-12-11 01:35:21
问题 I have just noticed that SharedPreferences removes carriage return (\r) when storing a string. Since it was quite costly for me to not know this, I would like to know if it removes any other characters. In other words, does it use a certain character set. SharedPreferences sp = activity.getSharedPreferences("preferences", Context.MODE_PRIVATE); sp.edit().putString("Foo", "\r\nfoo").commit(); //After restarting the app SharedPreferences sp = activity.getSharedPreferences("preferences", Context

Android app preferences are being cleared automatically

佐手、 提交于 2019-12-11 00:31:47
问题 All of a sudden, each time I start my app, my user preferences are being cleared out. Instead of using preferences directly in an Activity, I have a helper class in my Application object, that accesses preferences like this: SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); This has worked perfectly, until just now. I have a custom application class that manages most of the content of the application, to avoid issues of re-generating this content when

Default value of custom DialogPreference is null

自闭症网瘾萝莉.ら 提交于 2019-12-10 21:32:40
问题 I have a TimePreference class that derives from DialogPreference . I'm using 3 NumberPicker to set hours, minutes and seconds. This works fine. But when onSetInitialValue is called defaultValue is always null . Whereas onGetDefaultValue returns the correct value that is defined in the preferences. Any ideas what is wrong? public TimePreference(Context ctxt, AttributeSet attrs, int defStyle) { super(ctxt, attrs, defStyle); setPositiveButtonText(R.string.ok); setNegativeButtonText(R.string