Save little information as setting in android (like first time that app is run)

android, application-settings, database, java

Solution

Use `SharedPreferences`.

SharedPreferences preferences = getSharedPreferences("prefName", MODE_PRIVATE);
SharedPreferences.Editor edit= preferences.edit();

edit.putBoolean("isFirstRun", false);
edit.commit();

Problem

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.

Original source