Created
October 1, 2018 14:35
-
-
Save isfaaghyth/91d90aecf69af3448f23b83b29920462 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.SharedPreferences; | |
import android.preference.PreferenceManager; | |
import android.util.Log; | |
import app.rangers.ranger.RangerApplication; | |
public class CacheManager { | |
private static final String TAG = "CacheManager"; | |
private static SharedPreferences getPref() { | |
return PreferenceManager.getDefaultSharedPreferences(RangerApplication.getContext()); | |
} | |
public static void save(String key, String value) { | |
Log.d(TAG, "saveCache: " + value); | |
getPref().edit().putString(key, value).apply(); | |
} | |
public static String grab(String key) { | |
return getPref().getString(key, null); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment