-3
每當我的應用程序關閉時,我想保存當前的數據!我想保存我的Android應用程序的數據
這是我的一段代碼,它不工作!
protected void onSaveInstanceState(Bundle outState){
super.onSaveInstanceState(outState);
outState.putDouble(TOTAL, total);
outState.putDouble(CURRENT_VALUE , currVal);
outState.putDouble(BILL_WITHOUT_VAL, billBeforeVal);
}
我可以使用SQL,而不是這個?
如果要保存的數據量小那麼你去'SharedPreferences'而不是創建數據庫。 – zanky
以下是您的選項,以及代碼示例:http://developer.android.com/guide/topics/data/data-storage.html –
改爲使用共享首選項。看看我的帖子,知道它的工作http://stackoverflow.com/questions/20491764/returning-data-result-to-parent-activity-using-intents/20492029#20492029 – AndroidHacker