java - Login Directly second time -


i want create login page user login first time. when user want use app second time dont have encounter login page. code here

 loginpreferences = getsharedpreferences("loginprefs", mode_private);      loginprefseditor = loginpreferences.edit();      savelogin = loginpreferences.getboolean("savelogin", false);       if (savelogin == true) {             name.settext(loginpreferences.getstring("username", ""));             pass.settext(loginpreferences.getstring("password", ""));          }      login.setonclicklistener(new onclicklistener()     {         @override         public void onclick(view v) {              name1 = name.gettext().tostring();              pass1 = pass.gettext().tostring();            //new thread (new task()).start();                 loginprefseditor.putboolean("savelogin", true);                 loginprefseditor.putstring("username", name1);                 loginprefseditor.putstring("password", pass1);                 loginprefseditor.commit();              new myasynctask().execute();         }     }); 

this code provides remember user's username , password still when user want use app second time have encounter login page.

how can solve problem.

thanks help.

one way go design app's architecture set main portion of app the first activity launch. first thing activity check shared preferences see if user has authenticated themselves. if haven't, launch login activity , finish main activity.


Comments

Popular posts from this blog

.htaccess - htaccess convert request to clean url and add slash at the end of the url -

php - facebook and github login HWIOAuthBundle and FOSUserBundle in Symfony2.1 -

hadoop - Sqoop installation export and import from postgresql -