简体   繁体   English

具有本地IP地址的Uri.parse

[英]Uri.parse with local ip address

I'm trying to launch the Browser with an ip-address. 我正在尝试使用ip地址启动浏览器。

String url = "//192.168.178.1"
Intent i = new Intent(Intent.ACTION_VIEW);
i.addCategory(Intent.CATEGORY_BROWSABLE);
i.setData(Uri.parse(url));
startActivity(i);

But instead of browsing the ip, the App crashes and I only get a "new tab" window on the browser. 但是,该应用程序崩溃了,没有浏览ip,而是在浏览器上只显示了“新标签”窗口。

you missed the schema for your url. 您错过了网址的架构。 Change it in String url = "http://192.168.178.1" String url = "http://192.168.178.1"更改

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM