I am writing a PreferenceActivity
for my Android app. I have question about ListPreference
.
How can I make a ListPreference
that does an action if the 1st, 2nd, or 3rd string is selected? The XML looks like this:
<ListPreference
android:defaultValue="1000"
android:dependency="perform_updates"
android:entries="@array/Select_Shoe_Country"
android:key="updates_interval"
android:summary="Select Shoe"
android:title="Example1" /> `
First of all, you need an android:entryValues
array so that the system knows what each of the user's options means. Now, to directly answer your question, it may be easiest to launch an Intent
based on the android:entryValues
that is selected. Of course, it really depends on what exactly you want it to do.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.