Kotlin

Send a message

Time to send the first message.

To send a message register a callback inside onCreate method:

findViewById<View>(R.id.sendMessageButton).setOnClickListener { sendMessage() }

Add sendMessage method inside MainActivity:

The above method hides the keyboard, clears the text field and sends the message.

Now in the MainActivity add the missing hideKeyboard method - the utility method that hides Android system keyboard:

You'll notice that, although the message was sent, the conversation doesn't include it. Let's do that in the next step.