kumar
kumar

Reputation: 645

What is use of preference activity in android?

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

Upvotes: 22

Views: 8898

Answers (7)

Durai Amuthan.H
Durai Amuthan.H

Reputation: 32270

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

Upvotes: 10

user3248606
user3248606

Reputation: 1

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.

Upvotes: 0

user3103823
user3103823

Reputation: 135

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

Upvotes: 1

Rachita Nanda
Rachita Nanda

Reputation: 4659

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.

Upvotes: 0

sealz
sealz

Reputation: 5408

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

Upvotes: 0

Joakim Berglund
Joakim Berglund

Reputation: 2871

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

Upvotes: 17

waqaslam
waqaslam

Reputation: 68177

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

Upvotes: 0

Related Questions