I am new to Xmpp and am confused right now.When I add a new Toast to the ConnectionListener interface methods the Toast does not show up in the application.
My code:
conn2.addConnectionListener(new ConnectionListener()
`````` {``
`` @Override
public void connected(XMPPConnection xmppConnection)
{
Toast.makeText(getApplicationContext(), “connected”, Toast.LENGTH_LONG).show();
}
@Override
public void authenticated(XMPPConnection xmppConnection, boolean b)
{
Toast.makeText(getApplicationContext(), “authenticated”, Toast.LENGTH_LONG).show();
}
@Override
public void connectionClosed()
{
Toast.makeText(getApplicationContext(), “conclose”, Toast.LENGTH_LONG).show();
}
@Override
public void connectionClosedOnError(Exception e)
{
Toast.makeText(getApplicationContext(), “conclose”, Toast.LENGTH_LONG).show();
}
@Override
public void reconnectionSuccessful()
{
Toast.makeText(getApplicationContext(), “reconnect”, Toast.LENGTH_LONG).show();
}
@Override
public void reconnectingIn(int i)
{
Toast.makeText(getApplicationContext(), “reconnect”, Toast.LENGTH_LONG).show();
}
@Override
public void reconnectionFailed(Exception e)
{
}
});``
This is what I expect the code to do:Whenever a connection is established there should be a new Toast that appears on the screen saying “Connected”.What am I doing wrong.Is it the wrong way to do this?