22

I have studied preference activity but I don't understand it. Can anybody tell me what is the use of preference activity? How does it differ from activity?

Thanks

sealz
  • 5,348
  • 5
  • 40
  • 70
kumar
  • 645
  • 2
  • 14
  • 24

7 Answers7

17

PreferencesActivity is a way to easily create preference screens such as those in Android itself, just look under Settings. These can be used inside applications to easily save preferences to SharedPreferences and then easily access these from within your app.

See this page for more information on PreferenceActivity.

An example of a PreferenceActivity showing some preferences:

enter image description here

Community
  • 1
  • 1
Joakim Berglund
  • 2,859
  • 1
  • 22
  • 30
10

Use:

It gives a very easy way to create a standard looking settings screen for any application.

Why:

minimal coding is required

How it works:

it takes care of UI.The values are stored in SharedPreferences automatically by the PreferenceActivity and so its scope becomes app wide.

Sample Screen UI:

Preference Activity

Durai Amuthan.H
  • 31,670
  • 10
  • 160
  • 241
1

such settings screen, you can use it for your app where user want to change setting.

user3103823
  • 135
  • 1
  • 3
  • 13
0

It is usually used to create a settings screen for applications .The values are stored in SharedPreferences automatically as soon as user selects a preference setting. It frees the programmer from explicitly saving preference values.

Rachita Nanda
  • 4,509
  • 9
  • 42
  • 66
0

PreferenceActivity is a class that allows you to implement an activity that realizes a hierarchical organization of choices. Most often it provides a good bases for building the settings activity in you application.

0

Its one stop to manage your Shared Preferences. Through this, you can provide a group of Settings to user for your app. Since it only deals with preferences, that's why its different from regular Activity. Read this for more info

waqaslam
  • 67,549
  • 16
  • 165
  • 178
0

PreferenceActivity supports the simple handling of preferences. It can show a set of preferences to the user.

An activity on the other hand is a single thing a user can do.

Checkout Section 13 at this link

sealz
  • 5,348
  • 5
  • 40
  • 70