In the previous section, we looked at how we can use the DataApi.putDataItem
method to send a binary image data to the Android wearable. In this section, we will be taking a look at how we can retrieve the image and display it within our Android wearable watch area:
From the Project Navigator window, open the
WearActivity.java
file.Next, modify the
WearActivity
class and add the following code snippet:public class WearActivity extends Activity { private TextView mTextView; private ImageView imageView; private GoogleApiClient mGoogleApiClient; private Bitmap imageBitmap; private final Handler imageHandler = new Handler(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_wear); final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub); stub.setOnLayoutInflatedListener(new ...