我想保存我的Android应用程序的数据

时间:2013-12-10 11:18:09

标签: android sql database android-sqlite

每当我的应用程序关闭时,我想保存当前数据!

这是我的一段代码,它不起作用!


protected void onSaveInstanceState(Bundle outState){    
    super.onSaveInstanceState(outState);        
    outState.putDouble(TOTAL, total);
    outState.putDouble(CURRENT_VALUE , currVal);
    outState.putDouble(BILL_WITHOUT_VAL, billBeforeVal);            
}

我可以使用sql代替吗?

1 个答案:

答案 0 :(得分:0)

你可以使用android.content.SharedPreferences

http://developer.android.com/reference/android/content/SharedPreferences.html

编辑:只需查看Ken Wolf对所有存储选项的评论......

相关问题