Google have deprecated the framework PreferenceManager class, and we should now use the androidx class instead.

There are a few changes to make, to the code in the next video.

The first is to add a dependency to the build.gradle (Module: app) file.

In the dependencies section, add the line

implementation 'androidx.preference:preference:1.1.0'


Next, change the import in MainActivity to

import androidx.preference.PreferenceManager


You'll then get an error in onResume, and will have to add a null check:

if (queryResult != null && queryResult.isNotEmpty()) {
    val url = createUri("https://api.flickr.com/services/feeds/photos_public.gne", queryResult,"en-us", true)
    val getRawData = GetRawData(this)
    getRawData.execute(url)
}


The import in SearchActivity also needs changing to use the androidx PreferenceManager.