O'Reilly logo

Android Wearable Programming by Steven F. Daniel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending messages to the Android wearable

In this section, we will be taking a look at the steps involved in sending a message to your Android wearable device. This process is quite simple, and our next step is to write the code that will communicate between our Android wearable and the handheld device:

  1. From the Project Navigator window, open the MobileActivity.java file.
  2. Next, modify the onCreate(Bundle savedInstanceState) method and enter the code highlighted as follows:
    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_mobile);
    
      // Get a pointer to our buttons and textField
      final Button mSendMessageButton = (Button) 
      findViewById(R.id.send_message_button);
     final ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required