I am using Quickblox sdk to integrate chat into my app.
I have created the Quickblox Session and also logged in user into "Chat Service".
But, when I try to send a message to the "Recipent" the application crashes, throwing following exception:
Attempt to invoke virtual method 'void com.quickblox.chat.QBAbstractChat.sendMessage(com.quickblox.chat.model.QBChatMessage)' on a null object reference
Given below is my code:
QBChatMessage chatMessage = new QBChatMessage();
chatMessage.setBody(strMsg);
chatMessage.setProperty(PROPERTY_SAVE_TO_HISTORY, "1");
chatMessage.setDateSent(System.currentTimeMillis() / 1000);
chatMessage.setMarkable(true);
try {
qbChatDialog.sendMessage(chatMessage);
} catch (Exception e) {
e.printStackTrace();
}