61.7 Sending a Message to the Remote Service
All that remains before testing the application is to implement the sendMessage() method in the MainActivity class which is configured to be called when the button in the user interface is touched by the user. This method needs to check that the service is connected, create a bundle object containing the string to be displayed by the server, add it to a Message object and send it to the server:
public void sendMessage(View view)
{
if (!isBound) return;
Message msg = Message.obtain();
Bundle bundle = new Bundle();
bundle.putString("MyString", "Message Received");
...