使用Intent.ACTION_VIEW而无需在浏览器中打开

时间:2016-02-11 12:59:02

标签: android url android-intent hyperlink arduino

我想通过cc3000连接arduino和android,它在两侧都很完美。 好吧,在arduino中,我们访问http://ip/location1http://ip/location2

在android中我正在使用

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://ip/location1"));
startActivity(intent); 

你知道我为什么不使用

HttpClient httpClient = new DefaultHttpClient();
HttpContext localContext =  new BasicHttpContext();
HttpGet httpGet = new HttpGet("http://ip/location1");
HttpResponse response = httpClient.execute(httpGet, localContext);

它不起作用,甚至没有连接

那么,如何让它访问网址,而无需打开浏览器?使用Intent.ACTION_VIEW

1 个答案:

答案 0 :(得分:0)

您可以在WebView中加载网址。 Webview是一个Android小部件,允许您在应用上显示网页。请查看此答案以了解实施情况:

how to display progress while loading a url to webview in android?

相关问题