如何使用Android小部件在浏览器上打开图片网址 [英] How to open image url on browser using android widget
本文介绍了如何使用Android小部件在浏览器上打开图片网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用android小部件中的intent在浏览器中打开图像.
How do i use intent in android widget to open images in browser.
推荐答案
如果图像在互联网上,则将像这样简单:
If the image is on the internet it would be as simple as this:
String url = "http://www.picturesnew.com/media/images/image-background.jpg";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
但是,如果图像在您的资产中,则无法在浏览器中将其打开.这是因为浏览器接受以http
开头的URI数据.此外,浏览器是一个单独的应用程序,一个应用程序不能使用其他应用程序资产.
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.
不过,您可以通过使用WebView来浸渍图像.
You could dipslay the image through the use of a WebView though.
这篇关于如何使用Android小部件在浏览器上打开图片网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文