tags:

views:

104

answers:

4

i have a android application which needs username and password to login, i need to save the username and password locally in phone or some where to use them when the user opens the app next time and logins to the app automatically without showing the login screen

    EditText input1 = (EditText) findViewById(R.id.usertext);
    EditText input2 = (EditText) findViewById(R.id.Passtext);
    String username = input1.getText().toString();
    String password = input2.getText().toString();

if login successful ill call the activity through intent

A: 

As a side note, do NOT store credential information in plain text. If you must store it, keep it as an encrypted digest or hash or use a different system like OAUTH if the service you are using supports it.

Konrad
A: 

You can use preferences or a file if you don't really care about security. You should encrypt the password if you're gonna store them though. See here for a better description of the options.

gatnowurry
+1  A: 

I would recomend to use something like MD5 or SHA1 for hashing your password before storing.

A possible place to store could either be "preferences" or the sqlite DB (not such usefull for only one single dataset)

poeschlorn
+1  A: 

If you are using ApiLevel >= 5 read about AccountManager.

Macarse