Craig - None of your responses are valid because I am using the two
PreferenceScreens in the same .java file, so that wouldn't help.
Peli - No, I do not use onPreferenceTreeClick(PreferenceScreen,
Preference). This is my code:
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setPreferenceScreen(createPreferenceHierarchy());
}
private PreferenceScreen createPreferenceHierarchy() {
PreferenceScreen root = getPreferenceManager
().createPreferenceScreen(this);
// Toggle preference
CheckBoxPreference passProtect = new CheckBoxPreference(this);
passProtect.setTitle("Password Protection");
passProtect.setKey("PasswordProtection");
String email = settings.getString("Email", null);
String password = settings.getString("Password", null);
String emailIsValid = new Boolean(isValid(email)).toString();
if (email != null && email != "" && password != null &&
password != "" && emailIsValid == "true") {
passProtect.setEnabled(true);
} else {
passProtect.setEnabled(false);
passProtect.setChecked(false);
}
// List preference
ListPreference interval = new ListPreference(this);
interval.setEntries(R.array.intervalTimes);
interval.setEntryValues(R.array.intervalTimes);
interval.setDialogTitle("Interval Time");
interval.setKey("IntervalTime");
interval.setTitle("Interval Time");
interval.setValueIndex(0);
//Dialog Preference
PreferenceCategory settingsCategory = new PreferenceCategory
(this);
settingsCategory.setTitle("Settings");
root.addPreference(settingsCategory);
// Screen preference
PreferenceScreen screenPref = getPreferenceManager
().createPreferenceScreen(this);
screenPref.setKey("userInfoScreen");
screenPref.setTitle("User Information");
//screenPref.getOnPreferenceClickListener({String falsee =
"false";});
settingsCategory.addPreference(interval);
settingsCategory.addPreference(screenPref);
settingsCategory.addPreference(passProtect);
//User Information Category
PreferenceCategory userInfoCategory = new PreferenceCategory
(this);
userInfoCategory.setTitle("User Information");
screenPref.addPreference(userInfoCategory);
// Edit text preference
EditTextPreference passwordPref = new EditTextPreference
(this);
passwordPref.setDialogTitle("Password");
passwordPref.setKey("Password");
passwordPref.setTitle("Password");
EditText passwordEditText = passwordPref.getEditText();
PasswordTransformationMethod transMethod = new
PasswordTransformationMethod();
passwordEditText.setTransformationMethod(transMethod);
screenPref.addPreference(passwordPref);
// Edit text preference
EditTextPreference emailPref = new EditTextPreference(this);
emailPref.setDialogTitle("Email Address");
emailPref.setKey("Email");
emailPref.setTitle("Email Address");
screenPref.addPreference(emailPref);
return root;
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---