Skip to content Skip to sidebar Skip to footer

How To Open Image Url On Browser Using Android Widget

How do i use intent in android widget to open images in browser.

Solution 1:

If the image is on the internet it would be as simple as this:

Stringurl="http://www.picturesnew.com/media/images/image-background.jpg";
Intenti=newIntent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

However if the image is inside of your assets you can't open it in the browser. That's because the browser accepts URI data that starts with http. Furthermore the browser is a separate app and one app can't use other apps assets.

You could dipslay the image through the use of a WebView though.

Solution 2:

To open a website from your widget:

Intent intent= newIntent(Intent.ACTION_VIEW, Uri.parse("http://www.fakesite.com\articles"));
startActivity(intent);

Post a Comment for "How To Open Image Url On Browser Using Android Widget"