private void sendMessage() { if (service != null) { SipProfile acc = accountChooserButton.getSelectedAccount(); if (acc != null && acc.id != SipProfile.INVALID_ID) { try { String textToSend = bodyInput.getText().toString(); if (!TextUtils.isEmpty(textToSend)) { service.sendMessage(textToSend, remoteFrom, (int) acc.id); bodyInput.getText().clear(); } } catch (RemoteException e) { Log.e(THIS_FILE, "Not able to send message"); } } } }