How to do one time registration in android? -
in android application, want show registration page @ time of registration after directly go main activity, doesn't go registration page again if open.
i did this,it works but.
if open app , close before registration process, registration page didn't appear next time, without registration. how can avoid that.
how write condition disappear activity after registration process.
sharedpreferences pref = getsharedpreferences("activitypref", context.mode_private); if(pref.getboolean("activity_executed", false)){ intent intent = new intent(this, track.class); startactivity(intent); finish(); } else { editor ed = pref.edit(); ed.putboolean("activity_executed", true); ed.commit(); }
guys please help!
sharedpreferences _regpref; boolean _usertype = "";
you have check shref pref before setcontentview method like:
_regpref = getapplicationcontext().getsharedpreferences("loginpref", 0); _usertype = _regpref.getstring("registerd", _usertype); if (_usertype==true) { try { startactivity(new intent(_ctx, youractivity.class)); finish(); overridependingtransition(r.anim.enter_new_screen, r.anim.exit_old_screen); } catch (exception e) { e.printstacktrace(); } }else { set contentview("your register activity view"); }
after registration succesful, save values in shred pref like:
editor prefseditor = _regpref.edit(); _usertype = false; prefseditor.putstring("registerd", _usertype); prefseditor.commit();
Comments
Post a Comment