Uri.fromParts在Android Emulator上为我提供了一个%2F

Uri.fromParts在Android Emulator上为我提供了一个%2F,android,android-emulator,uri,Android,Android Emulator,Uri,我使用以下代码: Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.fromParts("http", "//google.com/", "")); //fromParts is ok b/c the scheme is different startActivity(i); 但在Android Emulator的浏览器上,我得到了以下地址: http://2F%2Fgoogle.com 为什么呢?如何解决这个问题呢?阅读,Uri

我使用以下代码:

Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.fromParts("http", "//google.com/", "")); //fromParts is ok b/c the scheme is different
startActivity(i);
但在Android Emulator的浏览器上,我得到了以下地址:

http://2F%2Fgoogle.com

为什么呢?如何解决这个问题呢?

阅读,
Uri.fromParts()
构建一个
OpaqueUri
OpaqueUri.toString()
URL对特定于方案的部分进行编码,将
//code>更改为
%2F

这是一个:

对ssp进行编码,这意味着此方法不能用于创建分层URI

要获取所需的层次Uri,请使用

Uri.parse("http://google.com/")
或者使用。

读取,
Uri.fromParts()
构建一个
OpaqueUri
OpaqueUri.toString()
URL对方案特定部分进行编码,将
/
更改为
%2F

这是一个:

对ssp进行编码,这意味着此方法不能用于创建分层URI

要获取所需的层次Uri,请使用

Uri.parse("http://google.com/")
或使用