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();