Back to project page introToDroid4ed.
The source code is released under:
GNU General Public License
If you think the Android project introToDroid4ed listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.introtoandroid.userprefsheaders; // w w w . ja v a 2 s . c o m import java.util.List; import android.os.Bundle; import android.preference.PreferenceActivity; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; public class UserPrefsActivity extends PreferenceActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onBuildHeaders(List<Header> target) { loadHeadersFromResource(R.xml.preference_headers, target); } public static class UserNameFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceManager manager = getPreferenceManager(); manager.setSharedPreferencesName("user_prefs"); addPreferencesFromResource(R.xml.personal_settings); } } public static class GameSettingsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceManager manager = getPreferenceManager(); manager.setSharedPreferencesName("user_prefs"); addPreferencesFromResource(R.xml.game_settings); } } public static class CharacterSettingsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceManager manager = getPreferenceManager(); manager.setSharedPreferencesName("user_prefs"); addPreferencesFromResource(R.xml.character_settings); } } }