2013-12-10 43 views
-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,而不是这个?

+2

如果要保存的数据量小那么你去'SharedPreferences'而不是创建数据库。 – zanky

+1

以下是您的选项,以及代码示例:http://developer.android.com/guide/topics/data/data-storage.html –

+0

改为使用共享首选项。看看我的帖子,知道它的工作http://stackoverflow.com/questions/20491764/returning-data-result-to-parent-activity-using-intents/20492029#20492029 – AndroidHacker

回答

相关问题