我想將當前日期保存到我的列表視圖中的一個textview我有一切設置,所以沒有必要幫助那裏只需將日期保存到textview我的代碼如下有人可以告訴我什麼錯?將日期保存到共享首選項
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = settings.edit();
editor.putLong("time", date.getTime());
editor.commit();
Date date2 = new Date(settings.getLong("time", 0));
錯誤,你得到什麼 – tyczj
@tyczj沒有它只是不節能的日期,而不是明天它會將我的列表視圖中的所有日期設置爲明天的日期聽起來像我知道的getView和.setText – LimpLimp
您的代碼對我來說看起來沒問題。你有沒有調試過你發佈的那部分。我很確定它工作正常。也許這個問題(在ListView中的日期?)在其他地方? – Ridcully