地图意图不工作与特定的缩放级别以及自定义标记
Map Intent not working with specific zoom level as well as custom marker
float lat = 40.714728f;
float lng = -73.998672f;
String maplLabel = "ABC Label";
final Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q="+lat+","+lng+"&z=16 (" + maplLabel + ")"));
startActivity(intent);
任何人都知道什么是错的?或者该怎么办呢? 我想显示地图一定的(纬度,经度)与自定义标签,标记在一个特定的缩放级别。
Anybody know what is wrong? or how to do so? I want to show map of certain (lat,lng) with a custom label-marker at a specific zoom level.
请尝试以下解决方案:
double latitude = 40.714728;
double longitude = -73.998672;
String label = "ABC Label";
String uriBegin = "geo:" + latitude + "," + longitude;
String query = latitude + "," + longitude + "(" + label + ")";
String encodedQuery = Uri.encode(query);
String uriString = uriBegin + "?q=" + encodedQuery + "&z=16";
Uri uri = Uri.parse(uriString);
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri);
startActivity(intent);
幸得这里:回答
我认为这个问题必须做在你的标签空间。编码的查询字符串将通过有效字符代替空格消除此问题
I believe the problem had to do with the spaces in your label. Encoding the query string will eliminate the issue by replacing the spaces with valid characters