【问题标题】:android.content.ActivityNotFoundException: No Activity found to handle Intent - googleMapsandroid.content.ActivityNotFoundException:找不到处理意图的活动 - googleMaps
【发布时间】:2017-09-29 12:52:45
【问题描述】:

我正在尝试链接列表视图项目中的地址,这将允许旅游景点的位置出现在谷歌地图上。执行此操作时遇到错误并且应用程序崩溃。日志中出现如下错误:

android.content.ActivityNotFoundException:未找到处理 Intent 的 Activity { act=android.intent.action.VIEW dat=google.streetview:cbll=46.414382,10.013988 pkg=com.google.android.apps.maps }

我正在使用 Google 开发者网站上的代码,但它似乎不起作用。代码如下:

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);

我已经添加了mContext,因为这之前有一个错误。

有人可以帮忙吗?

【问题讨论】:

    标签: android google-maps android-studio


    【解决方案1】:

    当设备/模拟器上未安装 Google 地图 应用时会发生这种情况。您需要安装谷歌地图或其他一些地图应用程序。

    试试

    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);
    

    【讨论】:

    【解决方案2】:

    试试这个:

     Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
                            Uri.parse("http://maps.google.com/maps?daddr="+dlat+","+dlng));
                    startActivity(intent);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-14
      • 1970-01-01
      相关资源
      最近更新 更多