1

Button logout = (Button) this.findViewById(R.id.btlogout); logout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            connection.disconnect();
            setContentView(R.layout.login);


        }
    });

this code is allowing me logout but not killing the session and the page which i am redirecting that page's button is not working .

1 Answers1

2

First of all send presence packet to server and then you should logout. This way your session will be killed.

Presence pr=new Presence(Presence.Type.unavailable);
connection.sendPacket(pr);
connection.disconnect();

it will first made you offline and then after disconnect from server.Hope it will help.Thanks.

Nirav Tukadiya
  • 3,367
  • 1
  • 18
  • 36