Created
August 7, 2018 19:09
-
-
Save drulabs/7fe102e27c9168c5c5783dce7d9ef6c6 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 | |
private fun doSomething(context: Context) { | |
val prefs = context.getSharedPreferences("app_prefs", Context.MODE_PRIVATE).edit() | |
prefs.persist(key = "my_name", value = "Kaushal Dhruw") | |
} | |
fun SharedPreferences.Editor.persist(key: String, value: String) { | |
putString(key, value) | |
apply() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment