如何保存的Andr​​oid应用程序登录信息?应用程序、信息、Andr、oid

2023-09-04 09:08:10 作者:侵她城夺她心

我有需要的用户名和密码登录一个Android应用程序。我需要在本地保存的用户名和密码在手机或其他地方使用它们,当用户将自动打开的应用程序,接下来的时间,登录到应用程序,而不显示登录屏幕

I have a android application which needs username and password to login. I need to save the username and password locally in phone or somewhere 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 the login is successful, it will call the activity through intent.

推荐答案

如果您使用的是ApiLevel> = 5读关于AccountManager.

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