package app.test;
import android.os.Bundle;
import android.preference.PreferenceActivity;
public class Test extends PreferenceActivity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.main);
}
}
//xml/main.xml
xmlns:android="http://schemas.android.com/apk/res/android"
android:key="using_categories_in_root_screen"
android:title="Categories"
android:summary="Using Preference Categories">
android:key="meats_category"
android:title="Meats"
android:summary="Preferences related to Meats">
android:key="fish_selection_pref"
android:title="Fish"
android:summary="Fish is great for the healthy" />
android:key="chicken_selection_pref"
android:title="Chicken"
android:summary="A common type of poultry" />
android:key="lamb_selection_pref"
android:title="Lamb"
android:summary="Lamb is a young sheep" />
android:key="vegi_category"
android:title="Vegetables"
android:summary="Preferences related to vegetable">
android:key="tomato_selection_pref"
android:title="Tomato "
android:summary="It's actually a fruit" />
android:key="potato_selection_pref"
android:title="Potato"
android:summaryOff="Yeah!"
android:summaryOn="My favorite vegetable" />