The way to use a preference file (instead of the default shared preferences) in PreferenceActivity is as follows:
public class MyPreferencesActivity extends PreferenceActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferenceManager prefMgr = getPreferenceManager();
prefMgr.setSharedPreferencesName("my_preferences");
prefMgr.setSharedPreferencesMode(MODE_WORLD_READABLE);
addPreferencesFromResource(R.xml.preferences);
}
}
In this example we use the Shared Preference named "my_preferences". But how would we use more than one custom preference in the same PreferenceActivity?