private void sendChatState (String to, ChatState currentChatState) { try { if (mConnection != null && mConnection.isConnected()) { // findOrCreateSession(to, false); Chat thisChat = mChatManager.createChat(JidCreate.from(to).asEntityJidIfPossible()); ChatStateManager.getInstance(mConnection).setCurrentState(currentChatState, thisChat); } } catch (Exception e) { Log.w(ImApp.LOG_TAG,"error sending chat state: " + e.getMessage()); } }