'Do I still need to use traditional way to implement Preferences Settings Screen in Jetpack Compose?

At present I use Jetpack Compose in my Android Studio project.

I find many projects still to use traditional way to implement a Preferences Settings Screen after I Google it.

I hope to implement a Preferences Settings Screen when I use Jetpack Compose, I don't know if there is a new way to implement Preferences Settings Screen, could you tell me?

And more, from the official document, it still need to use XML resource and PreferenceFragmentCompat to create Preference screen. It seems that I havn't found a sample project to create Preference screen with Jetpack Compose or other way.

But, from the document, it seems that SharedPreferences will be obsoleted.



Solution 1:[1]

Just leaving my opinion here...

I work for a consulting company, and in my last 12 years working with Android I didn't use this API at all, just because clients usually want a UI with a better design than that provided by Preferences UI API. Also, I think the approach provided by this API violates the Single Responsibility Principle since it mixes UI and Storage in the same component.

Finally, create a settings screens is a very simple task since they usually uses simple components like CheckBox, Switch, TextField, Slider, ... Therefore, I hadn't use and wouldn't plan to use the Preferences UI API.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1