<ListPreference
android:entries="@array/listOptions2"
android:entryValues="@array/listValues2"
android:key="listprefrefresh"
android:summary="Set refresh the Application"
android:title="Set Time Interval" />
<item>10 </item>
<item>30</item>
</integer-array>
<integer-array name="listValues2">
<item>10000</item>
<item>30000</item>
</integer-array>
这是我想要通过时间的代码我现在如何实现?我正在传递整数值。请告诉我
public static final String PREF_BEER_SIZE2 = "listprefrefresh";
Preference beerPref2 = (Preference) findPreference(PREF_BEER_SIZE2);
beerPref2
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference,
Object newValue) {
// TODO Auto-generated method stub
final ListPreference listrefresh = (ListPreference) preference;
final int idx = listrefresh
.findIndexOfValue((String) newValue);
if (idx == 0 ) {
handler.post(timedTask);
//
} else if (idx == 1) {
// System.out.println("2");
}
return true;
}
});