1

对于以下代码,为什么appendQueryParameter打开正确的给定位置但query没有打开?:

String address = "Mountain View, California, United States";
Uri.Builder builder = new Uri.Builder();
builder.scheme("geo")
        .path("0,0")
        // here appendQueryParameter launches external Google Maps app with correct location but 
        // query(address) has the wrong location (user's current location), why?
        .appendQueryParameter("q", address);
Uri uri = builder.build();
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(uri);
if (intent.resolveActivity(getPackageManager()) != null) {
    startActivity(intent);
}

appendQueryParameter的 Android 文档说:

对键和值进行编码,然后将参数附加到查询字符串。

虽然查询文档说:

编码和设置查询。

问题可能query是由于它使用的标签吗?它会使用什么标签?

4

0 回答 0