Images Sony Smartwatch 2

133 views Asked by At

I am trying to show an external image (not in my application project) in the Sony Smartwatch UI. I know how to do it with an image located in the drawable folder.

    Bundle iconBundle = new Bundle();
    iconBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.thumbnail);
    iconBundle.putString(Control.Intents.EXTRA_DATA_URI,
            ExtensionUtils.getUriString(mContext, R.drawable.thumbnail_list_item));

In this example I have the image in the drawable folder called R.drawable.thumbnail_list_item. The problem is when I try it with an external image. I have the following URL: http://tcset.com/images/logotcsetarriba.png, and this code does not work:

    Bundle iconBundle = new Bundle();
    iconBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.thumbnail);
    iconBundle.putString(Control.Intents.EXTRA_DATA_URI,
            ExtensionUtils.getUriString(mContext, "http://tcset.com/images/logotcsetarriba.png"));

How could I do it? I need held :S Thank you!!

3

There are 3 answers

1
trashkalmar On BEST ANSWER
0
pg316 On

You need to first download the image and then you can use sendImage combined with the image id you want to replace and the downloaded bitmap. For instance:

sendImage(R.id.image, bmp);

Does this answer your questions?

0
Alexander On

Unbelievable, but actually you can display a image that is not from the resources in a specific ImageView. It boils down to downloading the image into a byteArray, creating a Bundle and passing the image as Control.Intents.EXTRA_DATA.

Bundle iconBundle = new Bundle();
    iconBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.imageView);
iconBundle.putByteArray(Control.Intents.EXTRA_DATA, buffer);
showLayout(layoutId, layoutId, layoutId, new Bundle[] {iconBundle})

I have no idea why Sony omitted such an useful function.