【问题标题】:using Intent.ACTION_VIEW without opening in browser使用 Intent.ACTION_VIEW 而不在浏览器中打开
【发布时间】:2016-05-22 06:27:29
【问题描述】:

我想通过 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);

它不工作,它甚至没有连接

那么,如何在不打开浏览器的情况下使其访问 url?带有 Intent.ACTION_VIEW

【问题讨论】:

  • 在网页视图中调用它。
  • 你想达到什么目的??
  • @Rohit5k2 我想访问 url 而不在浏览器中打开

标签: android url android-intent hyperlink arduino


【解决方案1】:

您可以在 WebView 中加载您的网址。 Webview 是一个 Android 小部件,可让您在应用程序上显示网页。检查这个答案的实施:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-12
    • 2015-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多