如何presist的登录凭据并做自动登录Android中 [英] How to presist Login credentials and do auto-login in Android

查看:158
本文介绍了如何presist的登录凭据并做自动登录Android中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何保存用户名和密码?

How can I save userId and Password?

我在开发的需要来存储电子邮件ID和一个应用
密码,从而使用户可以直接重定向到他的主页,如果用户已存在

I am developing an application which requires to store email id and password, so that the user can directly redirect to his home page if the user already exists.

当用户登录时,他被直接引导到他的主页现在下一次。
他不应该再输入他的帐户及pasword。

Now Next time when the user logins, he is directed to his home page directly. He should not again type in his userId and pasword.

推荐答案

您可以流多个对象相同的文件

You can stream multiple objects to the same file

FileOutputStream fStream = openFileOutput(namefile.bin, Context.MODE_PRIVATE) ;
ObjectOutputStream oStream = new ObjectOutputStream(fStream);
oStream.writeObject(Username) ;
oStream.writeObject(Password) ;
oStream.flush() ;
oStream.close() ;

这篇关于如何presist的登录凭据并做自动登录Android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆