What is use of preference activity in android?-ThrowExceptions

Exception or error:

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

How to solve:

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

###

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

###

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

###

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

###

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

###

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.

###

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.

Leave a Reply

Your email address will not be published. Required fields are marked *