Add a New SettingsFragment

Right off the bat, I want to apologize and clarify the terms we’re using in this chapter. The class we’re creating is called SettingsFragment, which inherits from the AndroidX Preference library’s class PreferenceFragmentCompat. The SettingsFragment handles a number of Preference objects and <Preference> tags.

Then why are we calling this “Settings” instead of “Preferences”? The main reason is because the official Android Developers docs refer to the concept as Settings: https://link.mfazio.dev/settings. I know it may be confusing building out Settings with a number of Preference items, but I’m following the conventions established by the Android team. Another reason is the PreferenceFragment class already exists in ...

Get Kotlin and Android Development featuring Jetpack now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.