Your Second Kotlin Android App - Part 11: Shared | Ray Wenderlich

Shared Preferences is a way that we save data. This video covers the basics of using it.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4534-your-second-kotlin-android-app/lessons/11

there are no subtitles?

Please send an email to support@razeware.com and they should be able to help you out. Cheers!

In readLists, when looping through sharedPreferenceContents should we check each preference item to ensure that it is a HashSet of String prior to downcasting? Suppose we have saved other items in shared preferences?

@macsimus Can you please help with this when you get a chance? Thank you - much appreciated! :]

import android.preference.PreferenceManager is coming up as deprecated, and using import androidx.preference doesn’t seem to work, either, because it is unrecognized and presented in red. The Android os has changed since this video, though I can’t find a way to fix the problem and continue.

Hey there - yes, the preference manager is deprecated in Android Studio 3.5. I’m currently in the process of updating this course to the latest version of Android. You can try using the androidx version. See if you can import the following:

androidx.preference.PreferenceManager

The API looks the same so it should get you some movement. If that doesn’t work, you can always download an older version of Android Studio. We’ll have the updated course out in a few months.

Thanks!

Hi @bdmoakley
When is the course going to be updated for 3.5 ?

We really need the update for this , many changes are there !

We’re actually in the process of updating this course. It’s being edited right now. You should see it released soon on the site.

many thanks @bdmoakley for the reply
Will be waiting for it , Cheer !

I had to update the dependencies.
I had to add:
implementation “androidx.legacy:legacy-preference-v14:1.0.0”
implementation “androidx.preference:preference:1.0.0”

then resync the Gradle files THEN
“import androidx.preference.PreferenceManager”
will work.

1 Like

Thank you so much for this @devjmichealmurray :grinning:

You can find the newly updated course over here: https://www.raywenderlich.com/7503473-your-second-kotlin-android-app

1 Like

Oh wow, thank you!
I will stop here and start over in the newly updated course. It will also be good review as there was a lot to digest and I can’t possibly remember it all.

1 Like