I want to set开发者_如何转开发 an EditTextPreference every launch of the activity. For that i writed some code to set it but nothing happens:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.vidange);
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
SharedPreferences.Editor editor1 = settings.edit();
editor1.putString("prochain_vidange","12560");
editor1.commit();
}
What's the problem of this code ? Thank you for your help.
精彩评论