Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Advantages of PreferenceActivity

When adding a "settings" screen to my app I seem to have come up with two choices:

  • use the PreferenceActivity that is given by Android

  • create a standard Activity that saves all the user's choices

Assuming I don't mind writing the code that saves the preferences (a relatively trivial task), what other advantages are there to using a PreferenceActivity? If anything, using a standard Activity provides much more flexibility with regards to UI design.

like image 597
yydl Avatar asked Dec 17 '25 04:12

yydl


1 Answers

You are right, given the desired view complexity (which sometimes is not more usable - remember preferences should be easy to set), it might not make sense to implement a PreferenceActivity. The idea is to present a uniform configuration screen & visual style to the user. As such, a user will always know when he entered a preference screen.

From the docs:

Furthermore, the preferences shown will follow the visual style of system preferences. It is easy to create a hierarchy of preferences (that can be shown on multiple screens) via XML. For these reasons, it is recommended to use this activity (as a superclass) to deal with preferences in applications.

The docs say something about inflated views, maybe you could investigate whether complex layouts or custom views can be integrated.

like image 180
Sebastian Roth Avatar answered Dec 19 '25 19:12

Sebastian Roth