开发者

Run Method when Preference is Updated

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜