开发者

Run Method when Preference is Updated

开发者 https://www.devze.com 2023-01-06 01:30 出处:网络
How would I add a listener so that when a preference is changed (i.e开发者_高级运维. CheckBoxPreference) some

How would I add a listener so that when a preference is changed (i.e开发者_高级运维. CheckBoxPreference) some method is executed (i.e. Toast)

Preferences.java

public class Preferences extends PreferenceActivity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);


}

}

Main.java

[...]
SharedPreferences preferences;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
[...]


http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/AdvancedPreferences.html

0

精彩评论

暂无评论...
验证码 换一张
取 消