除少的信息,在Android的设置(如第一次应用程序运行) [英] Save little information as setting in android (like first time that app is run)
本文介绍了除少的信息,在Android的设置(如第一次应用程序运行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要救一个标志认识到我的应用程序运行在第一次与否。对于这个简单的工作,我不想创建数据库。
I want to save a flag for recognizing that my app is run for the first time or not. For this simple job I don't want to create database..
有一个简单的选择要做到这一点?我要保存和读取的小条信息只。
Is there a simple option to do this? I want to save and read little pieces of information only.
推荐答案
使用共享preferences
。
SharedPreferences preferences = getSharedPreferences("prefName", MODE_PRIVATE);
SharedPreferences.Editor edit= preferences.edit();
edit.putBoolean("isFirstRun", false);
edit.commit();
这篇关于除少的信息,在Android的设置(如第一次应用程序运行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文