如何只显示一次登录,然后后直接在android的应用程序启动 [英] How to display only one time Login and then after start application directly in android

查看:258
本文介绍了如何只显示一次登录,然后后直接在android的应用程序启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我越来越麻烦使得一次性登录......我的目标是第一个用户获取登录界面。如果他是新的用户,他将注册,然后登录......从那时候当过用户启动应用程序他应该直接重定向到是要跳过登录page..please朋友帮我从这个problem..please我张贴任何教程或code主要活动......请告诉我如何在清单文件也需要修改..

我使用像这样在登录活动,但我并没有达到我的任务。

 共享preferences preF;
共享preferences.Editor编辑;
preF = getShared preferences(testapp,MODE_PRIVATE);
编辑= pref.edit();
editor.putString(注册,真);
editor.commit();
的getStatus字符串= pref.getString(注册,无);
如果(getStatus.equals(真))
   //重定向到下一个活动
其他
   再次//显示注册页面


解决方案

点击此处查看

<一个href=\"http://www.androidhive.info/2012/08/android-session-management-using-shared-$p$pferences/\">http://www.androidhive.info/2012/08/android-session-management-using-shared-$p$pferences/

在Android应用程序会话管理的一个很好的例子。

I am getting trouble in making only one time login... My aim is first user gets login screen.. If he is new user he will register and then login...from then when ever user starts the application he should directly redirect to main activity that is to skip the login page..please friends help me out from this problem..please post me any tutorials or any code...please tell me how to modify in manifest file also...

I am using like this in login activity but i didn't achieve my task.

SharedPreferences pref;
SharedPreferences.Editor editor;
pref = getSharedPreferences("testapp", MODE_PRIVATE);
editor = pref.edit();
editor.putString("register","true");
editor.commit();
String getStatus=pref.getString("register", "nil");
if(getStatus.equals("true"))
   // redirect to next activity
else
   // show registration page again

解决方案

check it here

http://www.androidhive.info/2012/08/android-session-management-using-shared-preferences/

A very good example of session management in android app.

这篇关于如何只显示一次登录,然后后直接在android的应用程序启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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