Android, show dialog when you click ListPreference

Basically, I have a ListPreference to allow the user to change the X position of any text on my Live Wallpaper.

It contains 4 entries: upper, middle, lower and manual input X. The first three options are not a problem, I just get SharedPreferences in my WallpaperService class and check if they are upper, middle or lower and change the corresponding position to their choice.

However, the latter option turns out to be more complicated, and I want the pop-up window to notify EditText when the user clicks the ListPreference item "Manual input X" so that they can enter a value for X. I just cannot figure out how to make the pop-up warning window click this specific list item.

+3
source share
2 answers

You probably want to create a custom one ListPreference. Basically you want to go from ListPreference(see the Original here ) and provide a custom protected void onPrepareDialogBuilder(Builder builder)one in which you provide an additional “regular” and onclick element to handle the selection of the “custom” record.

, "custom", .

+3

onPreferenceTreeClick() PreferenceActivity , , - .

0

All Articles