I want a separate pop up window to be displayed where I can change a number value and for that to be saved
This is easy, you just have to make that Preference an EditTextPreference
at your xml file like so:
<EditTextPreference
android:title="@string/title"
android:key="preferenceKey" />
You can customize it more: if you only want integers android:numeric="integer"
, if you want to set the max length android:maxLength="3"
and the default value android:defaultValue="10"
. You don't have to do anything in the Java class
how do I add action when clicking on those preferences
If you want to add some more complicated action, use a Preference.OnPreferenceClickListener
. You can use it like so:
Preference preference = // some preference
preference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){
@Override
public boolean onPreferenceClick(Preference p){
//do something
return false;
}
});
You can find more at this question. Hope this helps
PS. If you want to customize the preference a lot (i.e. not only the action onClick, but also the layout etc), you should consider creating a custom Preference, as said at another answer.