android - Intent can't move to another activity using IF -


i'm having problem program. process when client send message,the server sends message, if message "ok", client move next activity didn't. code:

  onclicklistener sendonclicklistener = new onclicklistener() {      public void onclick(view v) {          thread.sendsocket(message.gettext().tostring());         handler handler = new handler();         handler.postdelayed(new runnable() {             public void run() {                      // actions after 3 seconds                  if(response.gettext().tostring().equals("ok")){                      intent = new intent(mainactivity.this,login.class);                     startactivity(i);                 }                 response.settext(thread.socketdata );             }         }, 3000);     } }; 

change if condition as

if(thread.socketdata.tostring().equals("ok")){      intent = new intent(mainactivity.this,login.class);     startactivity(i);  } 

and check.


Comments