A Preference Activity application in Android

We know that, for any good application, there will be a settings screen which can be used to customise the application. In an Android application, we can create user friendly settings screens using preference activity and preference screen. In this article we will see how to create a settings screen using preference activity and retrieve the settings values in an another activity.

In this application, there will be three activity screens as follows :

A. MainActivity : This is the screen shown when the application is launched.

Figure 1 : Main Activity

B. PreferenceActivity : This is the settings screen. This screen is displayed when the Main Activity’s “Settings” button is clicked.

Figure 2 : Preference Activity

Figure 3 : Preference Activity : EditText Preference

Figure 4 : Preference Activity : List Preference

Figure 5 : Preference Activity : Ringtone Preference

Figure 6 : Preference Activity : Second Page

C. ShowActivity : This screen shows the values from the settings. The is screen is displayed when MainAcitivity’s “Show Values” button is clicked.