Hiiiiii
i want to save user Name and password in my android application
using the android save preference. but its not working.
code is here\\\\\\\
import android.content.SharedPreferences;
protected void Savepreference()
{
int mode = Activity.MODE_PRIVATE;
SharedPreferences mySharedPreferences =
getSharedPreferences
(myprefs, mode);
SharedPreferences.Editor editor =
mySharedPreferences.edit();
String sip = sipText.getText().toString();
String user = UserText.getText().toString();
String pass = passText.getText().toString();
editor.putString(sipid,sip );
editor.putString(userid,user );
editor.putString(passid,pass );
editor.commit();
}
public void loadpreference()
{
int mode = Activity.MODE_PRIVATE;
SharedPreferences mySharedPreferences = getSharedPreferences
(myprefs, mode);
String sipid1 = mySharedPreferences.getString("sipid",
"Sipid");
String userid1 = mySharedPreferences.getString("userid", "User
Name");
String passid1 = mySharedPreferences.getString("passid",
"Password");
sipText.setText(sipid1);
UserText.setText(userid1);
passText.setText(passid1);
}
Thank You in advance
bhavesh
--
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