Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用android studio上的软件包在谷歌地图上添加pin点(当你点击一个按钮时,它会直接打开谷歌地图应用程序)_Android - Fatal编程技术网

如何使用android studio上的软件包在谷歌地图上添加pin点(当你点击一个按钮时,它会直接打开谷歌地图应用程序)

如何使用android studio上的软件包在谷歌地图上添加pin点(当你点击一个按钮时,它会直接打开谷歌地图应用程序),android,Android,我在谷歌地图上添加pin点时遇到了麻烦,我使用打开谷歌地图应用程序的软件包在android studio上显示位置点。这是密码 Uri gmmIntentUri = Uri.parse("geo:"+29.972653+","+31.283936); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); mapIntent.setPackage("com.google.android.apps.maps"); start

我在谷歌地图上添加pin点时遇到了麻烦,我使用打开谷歌地图应用程序的软件包在android studio上显示位置点。这是密码

Uri gmmIntentUri = Uri.parse("geo:"+29.972653+","+31.283936);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
试试这个:

String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(mapIntent);
Intent Intent=newintent(Intent.ACTION\u视图,Uri.parse(“geo:,?q=,”,
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:<" + latitude + ">,<" + longitude + ">?q=<" + latitude + ">,<" + longitude()));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");

try {
    context.startActivity(intent);
} catch (ActivityNotFoundException ex) {

    String urlAddress = "http://maps.google.com/maps?q=" + latitude + "," + longitude;
    Intent intents = new Intent(Intent.ACTION_VIEW, Uri.parse(urlAddress));
    context.startActivity(intents);
}