Android 谷歌地图应用程序从我的应用程序wid标签的位置
我可以从我的应用程序打开谷歌地图,并在我指向的位置上有一个指针 相反,我想从我的应用程序中打开谷歌地图应用程序——就像用户单击地址时谷歌地图应用程序打开该特定点一样 为此我用了Android 谷歌地图应用程序从我的应用程序wid标签的位置,android,google-maps,Android,Google Maps,我可以从我的应用程序打开谷歌地图,并在我指向的位置上有一个指针 相反,我想从我的应用程序中打开谷歌地图应用程序——就像用户单击地址时谷歌地图应用程序打开该特定点一样 为此我用了 startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:lat,lng?q=lat,lng"))); 此处lat=34.456373,lng=45.464748 谷歌地图应用程序正在打开,但那个特定的位置并没有出现,而是我
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:lat,lng?q=lat,lng")));
此处lat=34.456373,lng=45.464748
谷歌地图应用程序正在打开,但那个特定的位置并没有出现,而是我现在的位置出现了。如何纠正呢
String geoCode = "geo:0,0?q=" + PLACE_LATITUDE + ","+ PLACE_LONGITUDE + "(" + PLACE_NAME + ")";
Intent sendLocationToMap = new Intent(Intent.ACTION_VIEW,
Uri.parse(geoCode));
startActivity(sendLocationToMap);
有关更多详细信息,请参阅
String uri = String.format("geo:%f,%f", latitude, longitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);
看看这是否有帮助。如果我们不给出地名怎么办?如果你输入地名,给出准确的结果,否则他们看到你的所有地方的准确纬度和经度。很简单,兄弟。是的,我得到了thanx……最后一件事。。。。。在该特定位置,我们可以显示自己的默认文本吗?
lat.setText(String.valueOf(latitude));
lon.setText(String.valueOf(longitude));
String showMap = String.valueOf(latitude) + ","
+ String.valueOf(longitude);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("geo:0,0?q=" + (showMap)));
try {
startActivity(intent);
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Error in gps "+e, Toast.LENGTH_LONG).show();
}