设置SQLite数据库

时间:2017-11-28 12:58:38

标签: android android-sqlite

我需要记住我的android项目中的一些单值。但我看到的所有例子都是关于存储相同类型的数据。在这里使用SQLite数据库的最佳方法是什么?

1 个答案:

答案 0 :(得分:1)

您应该查看SharedPreferences的示例:

SharedPreferences mShared = getSharedPreferences("your package name", Context.MODE_PRIVATE);
SharedPreferences.Editor mSharedEdit = mShared.edit();
//Saving String
mSharedEdit.putString("key", "value").commit();
//Getting it back
mShared.getString("key","value if not exists");

更多信息:https://developer.android.com/training/data-storage/shared-preferences.html