开发者

EditTextPreference not set

开发者 https://www.devze.com 2023-03-27 15:44 出处:网络
I want to set开发者_如何转开发 an EditTextPreference every launch of the activity. For that i writed some code to set it but nothing happens:

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.

0

精彩评论

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