skip to Main Content

Android Studio – Why do we need to give default value inside getBoolean() in kotlin?

I'm trying to put some data whose key: "isLoggedIn" and a value: true inside a shared preference file. I do it this way... sharedPreferences=getSharedPreferences(getString(R.string.preference_file_name), Context.MODE_PRIVATE) fun savePreferences(){ sharedPreferences.edit().putBoolean("isLoggedIn",true).apply() } and then if I want to retreive/store this key-value pair inside…

VIEW QUESTION
Back To Top
Search