Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Save Session Data
import androidx.preference.PreferenceManager
//SEE IMPORT ABOVE
class LoginActivity : AppCompatActivity() {
...
private fun saveSessionData(name: String?, token: String?) {
val preferences =
PreferenceManager.getDefaultSharedPreferences(this)
val editor = preferences.edit()
editor.putString("Name", name)
editor.putString("Token", token)
editor.apply()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.