Android的我怎么能知道,如果它是第一次应用程序启动? [英] Android-How can I know if it is the first time the application launched?

查看:149
本文介绍了Android的我怎么能知道,如果它是第一次应用程序启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何才能知道它是否是第一次应用程序启动?

How can I know if it is the first time the application launched?

如果你回答,请加满code,因为我看过一些答案,我不明白他们。

If you are answering please add a full code because I have read some answers and I didn't understand them.

感谢。

推荐答案

使用共享preferences 的持久性数据storage.when首次推出的应用程序只是保存在共享preferences.Then布尔值,检查各一次。

Use sharedPreferences for the persistent data storage.when the application first launched just save a boolean value in the shared Preferences.Then check each time.

SharedPreferences sharedPref = getSharedPreferences("FileName",MODE_PRIVATE);
SharedPreferences.Editor prefEditor = sharedPref.edit();
prefEditor.putString("isLauncedTime",true);
prefEditor.commit();

这篇关于Android的我怎么能知道,如果它是第一次应用程序启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆