开发者

Date Preference exist?

开发者 https://www.devze.com 2023-03-26 23:33 出处:网络
I have some preferences (EditText and ListPreference) and i have to add a date preference in the XML file. is that possible and is it existing in sharedprefere开发者_如何学Pythonnces ?

I have some preferences (EditText and ListPreference) and i have to add a date preference in the XML file. is that possible and is it existing in sharedprefere开发者_如何学Pythonnces ?

Thank you for your help.


I'm pretty sure there is not a date picker for shared preferences, you would most likely have to create your own. You can however store a date into a preference using the

    SharedPreferences.Editor editor = sharedPreferences.edit();
    //editor.putLong(key, Long);
    editor.putLong("thecurrentdate", currentDate.getTime());

This would store the date into a preference, in your case you could store it into the EditText preference.

Maybe this post would help you? How to store a Date object in SharedPreferences?

Hope this helps!

0

精彩评论

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