[英]android.content.ActivityNotFoundException: No Activity found to handle Intent - googleMaps
I am trying to link an address in a list view item which will allow the location of a tourist attraction to appear on google maps.我正在尝试链接列表视图项中的地址,这将允许旅游景点的位置出现在谷歌地图上。 I am experiencing an error when I do this and the app crashes.
执行此操作时遇到错误并且应用程序崩溃。 In the log, the following error appears:
在日志中,出现以下错误:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=google.streetview:cbll=46.414382,10.013988 pkg=com.google.android.apps.maps }
android.content.ActivityNotFoundException:没有找到处理意图的活动{ act=android.intent.action.VIEW dat=google.streetview:cbll=46.414382,10.013988 pkg=com.google.android.apps.maps }
I am using the code which is on the Google developers website but it doesn't seem to work.我正在使用 Google 开发者网站上的代码,但它似乎不起作用。 The code is below:
代码如下:
Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4194");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
mContext.startActivity(mapIntent);
I have added the mContext
as this previously had an error before.我已经添加了
mContext
因为这之前有一个错误。
Can anyone please help?有人可以帮忙吗?
This happens when Google Maps app is not installed on the device/emulator.当设备/模拟器上未安装Google 地图应用程序时会发生这种情况。 You need to install google maps or some other map application.
您需要安装谷歌地图或其他一些地图应用程序。
Try尝试
Uri gmmIntentUri = Uri.parse("http://maps.google.com/maps?daddr=37.7749,-122.4194");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
//mapIntent.setPackage("com.google.android.apps.maps");
mContext.startActivity(mapIntent);
try this :尝试这个 :
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?daddr="+dlat+","+dlng));
startActivity(intent);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.