I am developing an android application that allows access to its contents when the user enters the password. I do not want to include a database, i just want the application to be able to create a new password for the user and also the user can be able to change the old password to a new one.
I have created two classes and one xml. But what i want now is to make the EdittextPreference pop up 3 edittext rather than the usual 1 so that the user can be able to change the old password. See the code so far
<EditTextPreference android:key="showPreferences"
android:title="Preferences"
android:summary="Admin Data"
android:defaultValue="Nothing"/>
<EditTextPreference android:key="editPassword"
android:title="Change Password"
android:summary="This allows you to change password"
android:defaultValue="Nothing"/>
package my.preferences;
import android.os.Bundle; import android.preference.PreferenceActivity;
public class SetPrefs extends PreferenceActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.prefs);
}
}
Store user password in
Shared Preference..
The SharedPreferences class provides a general framework that allows you to save and retrieve persistent key-value pairs of primitive data types. You can use SharedPreferences to save any primitive data: booleans, floats, ints, longs, and strings. This data will persist across user sessions (even if your application is killed).
Android - Shared Preferences