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.simpleuserprefs; /* w w w. j a v a 2s . c o m*/ import android.os.Bundle; import android.preference.PreferenceActivity; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.app.FragmentManager; import android.app.FragmentTransaction; public class SimpleUserPrefsActivity extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FragmentManager manager = getFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(android.R.id.content, new SimpleUserPrefsFragment()); transaction.commit(); } public static class SimpleUserPrefsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceManager manager = getPreferenceManager(); manager.setSharedPreferencesName("user_prefs"); addPreferencesFromResource(R.xml.userprefs); } } }