Yes, the first two options are a bit unpleasant, and as for the third, well 
its an option but I couldn't help feeling there had to be a better way. 
After some more thought I ended up adopting a slightly different approach 
altogether. I took out the two mutually exclusive sets of preferences and 
put them in two other preference files, 'a' and 'b'. Then I created a 
separate, new preference activity (MorePreferences, below) that in the 
onCreate method loaded 'a' or 'b' based on my checkbox preference value:

public void onCreate(final Bundle savedInstanceState) {

    

super.onCreate(savedInstanceState);

    
final int preferences;  
if (Preferences.isPreferencesA(this)) {

        preferences = R.xml.

}    
else {

    preferences = R.xml.

}


addPreferencesFromResource(preferences);


}

In the main preferences I put a PreferenceScreen entry in, which uses an 
intent to fire up the new preference activity - when activated it loads the 
right set of preferences:

<PreferenceScreen android:title="@string/announcement_settings" 
android:summary="@string/announcement_settings_summary">

<intent 

    android:action="android.intent.action.MAIN"

    android:targetPackage="mypackage"

    android:targetClass="mypackage.MorePreferences"/>         

</PreferenceScreen>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to