Created
December 2, 2016 08:44
-
-
Save m7mdra/2ce751e8d20d9abd2fb9e12a91330c28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.content.SharedPreferences; | |
public class PrefManager { | |
SharedPreferences pref; | |
SharedPreferences.Editor editor; | |
Context _context; | |
// shared pref mode | |
int PRIVATE_MODE = 0; | |
// Shared preferences file name | |
private static final String PREF_NAME = "firstTimeLaunch"; | |
private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch"; | |
public PrefManager(Context context) { | |
this._context = context; | |
pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); | |
editor = pref.edit(); | |
} | |
public void setFirstTimeLaunch(boolean isFirstTime) { | |
editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime); | |
editor.commit(); | |
} | |
public boolean isFirstTimeLaunch() { | |
return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment