Android基于XMPP Smack Openfire连接断开重连老是出问题求大神帮忙
@Override
public void connectionClosed() {
XmppConnectionManager.getInstance().disconnect();
tExit=new Timer();
tExit.schedule(new timetask(), logintime);
}
@Override
public void connectionClosedOnError(Exception e) {
XmppConnectionManager.getInstance().disconnect();
tExit=new Timer();
tExit.schedule(new timetask(), logintime);
}
上面是ConnectionListener中的方法当断开重新连接时new一个timer两秒钟重新登录一次,但是时间长了会报timer空指针,求解这个重连到底要怎么写?着急用我都快愁死了