Ch. 8 PreferenceManager Deprecated

Everything is working as described in the book but I’m wondering what changes I need to make to account for the deprecation of the PreferenceManager class.

Amongst other things I tried importing androidx.preference.PreferenceManager instead of android.preference... per this SO post but that only resulted in an unresolved reference to preference.

I fear I’m a bit out of my league here, or I’m missing some fundamentals. Your iOS Apprentice book was much easier to follow as a complete novice iOS programmer. I’d hoped this book would be equally enlightening. Is there another book I should be starting with for Android development? Kotlin Apprentice was next on my list. Perhaps I should have started there.

Thanks for all your hard work putting these books together!

Kenny

Edit:
So I found and ran Refactor->Migrate to AndroidX…

and added implementation 'androidx.preference:preference-ktx:1.1.0' to build.gradle

After a few additional minor updates and a rebuild I seem to be in good shape.

Guess I jumped the gun posting here. Unless of course this was the wrong course of action…

Thanks again!

Hi kdewitt,

Welcome to the forums and well done on figuring out the issue yourself. Using Migrate to AndroidX was the right thing to do. :smiley:

You’ve picked up on something we need to do, update the book to use the AndroidX libraries. We intend to do this and I’ll share this thread with the rest of the team to show we need to do it soon.

For other books dedicated to beginning Android development, we suggest checking the Big Nerd Ranch Android book. It has a similar approach to our own and a lot of the team highly rate their books.

Thanks,

Darryl

@kdewitt One more thing. Was there anything in particular about the book you thought or felt wasn’t enlightening enough? We’re keen on making sure the book is the best it can be. :smile:

Thanks for the reply, @daemonic_daz

My remark comparing the two books was poorly worded. The Android Apprentice book is very enlightening. I suppose my innate preference for Apple combined with my frustration level got the better of me.

Thanks again to the entire team for all the hard work!

Kenny