<分区>
我想实现一个在用户第一次使用该应用程序时出现的屏幕,就像谷歌所做的那样。有没有特殊的元素可以使用?检查用户是否是第一次打开应用的最佳方法是什么?
<分区>
我想实现一个在用户第一次使用该应用程序时出现的屏幕,就像谷歌所做的那样。有没有特殊的元素可以使用?检查用户是否是第一次打开应用的最佳方法是什么?
最佳答案
查看 SharedPreferences。这很简单。
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean firstOpened = preferences.getBoolean("first_opened", true);
if(firstOpenened) {
showWelcomeScreen();
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("first_opened", false);
editor.apply();
}
关于java - Android 首次使用屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28926335/
相关文章:
android - OneSignal - 单击推送后无法打开 Activity
android - 如何清除 Android 堆栈中的所有现有 Activity
android - 无法在 xamarin 中的 android Activity 之间传递数据
java - 如何在 Release build 的 android 中使用 Proguard 防止 LOG 打印
android - 如何在启动时使用 root 权限在 Android Things 设备上运行 shell 脚本?
android - SimpleDateFormat(String template, Locale locale),例如 Locale.US 用于 ASCII 日期