开发者

Date Preference exist?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜