If you want to reset or change preferences of an app at the first start here is an example of code you can put in an event as onCreate of the main activity:
Continue reading “Resetting the preferences on first launch of an app”
I implemented a Time Picker in the preference using the code found here where the class TimePreference extends the class DialogPreference but I found a lack of alignment with the other preference items because of a different setting of the margins and/or padding.
In the Android preferences you can put different types of controls: check box, edit box, list,…, but none of these displays an icon (see Settings).
Usually a preference consists of two lines, the title and the summary, and after you have clicked you get a dialog box where you can select the chosen item, as you can see in the two pictures below.
Continue reading “How to display an icon in the preferences”
If you have an EditTextPreference tag in a xml file you can catch the click event implementing OnSharedPreferenceChangeListener but it doesn’t work if you have a Preference tag in the xml file.
Consider the following code inside a xml file for the preferences: