private void sendMessage() { // do not submit blank lines String messageBody = messageBox.getText().toString().trim(); if (messageBody.isEmpty()) { return; } // send the message to server and clear message box worker.sendMessages(chatId, messageBody); messageBox.setText(""); }