Checking if we came from Android Back Button -


i have android application looks this:

loginactivity -> mainactivity

my android problem if have logged in (we @ mainactivity), press button on phone, go loginactivity. doesn't make sense, because logged in.

how can check in loginactivity if came button? tried code, doesnt help, because oncreate not run when coming button.

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.login);      // check if registered before, go main     checkifweareregistered(); } 

it simple call finish() this

intent intent = new intent(loginactivity.this, homescreenactivity.class); startactivity(intent); finish(); 

or try this

 intent intent = new intent(loginactivity.this, homescreenactivity.class);  intent.setflags(intent.flag_activity_clear_top);  startactivity(intent); 

Comments

Popular posts from this blog

vue.js - Create hooks for automated testing -

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

serial port - hub4com OVERRUN Error -