-2

I want to show an image in my Sony Smarwatch Sample project. How can I add a link to an external URL? The URL has to be shown in my device not in the SmartWatch. My code is the following, with this my image is shown in the layout:

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));

¿How can I add a event to this bundle? I want to go to an external url. How can I add a link to my Preference Class?

xarrate
  • 25
  • 6
  • I don't know how to add an event to this image that I am showing in my layout. Could you help me please? – xarrate Jan 07 '15 at 14:07

1 Answers1

0

I am not totally sure I understand what you are asking, but if you want to be able to click on something on the watch and have it launch a url you can use this code:

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/developer?id=Sony+Mobile+Communications"));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ctxt.startActivity(intent);

If you want to launch the preference settings screen for your app you can do something like this:

    Intent intent = new Intent(ctxt, HelloLayoutsPreferenceActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ctxt.startActivity(intent);

This should work in the Hello Layouts sample project. The context is passed in the control extension constructor so you should be able to grab it from there. Please let me know if this is not what you were asking.

pg316
  • 1,380
  • 1
  • 8
  • 7
  • I guess what he meant was displaying image from web on the watch. Something like this: I want to show image on the SW2 screen, which I will download from http://www.example.com/image.jpg. I guess you have to download the image int he phone-part and than send it to the watch? – Kokesh Feb 22 '15 at 11:02
  • yes that is correct. Once you download the image then you can display it on the watch – pg316 Feb 23 '15 at 17:14