mercredi 3 juin 2015

Intent can't move to another activity using IF

I'm having a problem with my program. The process is when the client send a message,the server sends back a message, if the message is "OK", the client will move to the next activity but it didn't. This is my 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 to do after 3 seconds

                if(Response.getText().toString().equals("OK")){

                    Intent i = new Intent(MainActivity.this,LOGIN.class);
                    startActivity(i);
                }
                Response.setText(thread.Socketdata );
            }
        }, 3000);
    }
};

Aucun commentaire:

Enregistrer un commentaire