I\'m quite new to Android Development and just came across Preferences.
I found PreferenceScreen and wanted to create a login functionality with it. The only pr
I wanted to add an Exit link to the preferences and was able to modify Jakar's code to make it work like this:
Originally the 'Preference' was a 'EditTextPreference' which I hand edited.
Then in the class:
public class MyPreferences extends PreferenceActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.mypreferences);
Preference button = (Preference)getPreferenceManager().findPreference("exitlink");
if (button != null) {
button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference arg0) {
finish();
return true;
}
});
}
}
}