将简单的 GoogleMaps 应用程序与核心应用程序集成时出错

发布于 2024-12-06 04:39:43 字数 1584 浏览 0 评论 0原文

我正在做我的 GPS 应用程序。带有 GoogleMaps 的独立应用程序运行顺利(地图意图很容易调用)。我尝试将其集成到我的核心应用程序(它有几个其他意图)中,但在启动它时遇到问题。

我已经尝试过:

public class MapaG extends Activity {   
    public class MapaG1 extends MapActivity {

        private static final int latitudeE6= 50656428;
        private static final int longitudeE6 = 17899562;

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.widokmapy);

            MapView mapView = (MapView) findViewById(R.id.mapview);
            mapView.setBuiltInZoomControls(true);

            List<Overlay> mapOverlays = mapView.getOverlays();
            Drawable drawable = this.getResources().getDrawable(R.drawable.icon);
            NakladkaNaMape itemizedOverlay = new NakladkaNaMape(drawable, this);

            GeoPoint point = new GeoPoint(latitudeE6, longitudeE6);
            OverlayItem overlayitem = new OverlayItem(point, "Witaj w Opolu", "Polska");
            itemizedOverlay.addOverlay(overlayitem);
            mapOverlays.add(itemizedOverlay);

            MapController mapController = mapView.getController();

            mapController.animateTo(point);
            mapController.setZoom(12);
        }

        @Override
        protected boolean isRouteDisplayed() {
            return false;
        }
    }
}

LogCat 视角为我提供了未找到 Activity 的信息:

FATAL EXEPTION: main android.content.ActivityNotFoundException: No Activity found handle Intent {act=praca.dyp.k.d.MAPAG}

I'm doing my GPS app. Standalone app with GoogleMaps works smoothly (map intent is easy to invoke). I tried integrating it my core app (which has several other intents) and I'm having problem launching it.

I've tried this:

public class MapaG extends Activity {   
    public class MapaG1 extends MapActivity {

        private static final int latitudeE6= 50656428;
        private static final int longitudeE6 = 17899562;

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.widokmapy);

            MapView mapView = (MapView) findViewById(R.id.mapview);
            mapView.setBuiltInZoomControls(true);

            List<Overlay> mapOverlays = mapView.getOverlays();
            Drawable drawable = this.getResources().getDrawable(R.drawable.icon);
            NakladkaNaMape itemizedOverlay = new NakladkaNaMape(drawable, this);

            GeoPoint point = new GeoPoint(latitudeE6, longitudeE6);
            OverlayItem overlayitem = new OverlayItem(point, "Witaj w Opolu", "Polska");
            itemizedOverlay.addOverlay(overlayitem);
            mapOverlays.add(itemizedOverlay);

            MapController mapController = mapView.getController();

            mapController.animateTo(point);
            mapController.setZoom(12);
        }

        @Override
        protected boolean isRouteDisplayed() {
            return false;
        }
    }
}

LogCat perspective gives me info that no Activity was found:

FATAL EXEPTION: main android.content.ActivityNotFoundException: No Activity found handle Intent {act=praca.dyp.k.d.MAPAG}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

温柔戏命师 2024-12-13 04:39:43

我想知道为什么要在 Activity 中创建 MapActivity 类?删除外部活动类声明。保留 MapActivity 类。在清单中使用适当的权限。

I'm wondering why you are creating a MapActivity class inside an Activity? Remove the outer activity class declaration. Keep the MapActivity class. Use proper permissions in Manifest.

无所谓啦 2024-12-13 04:39:43

您是否在 AndroindManifest.xml 文件中添加了 MapAcitivity?

您还需要将其包含在清单中:

<uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.INTERNET" />

您可以在此处查看更详细的示例:

HelloWorld,MapActivity

Did you add your MapAcitivity in your AndroindManifest.xml file?

You also need to include this in your manifest:

<uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.INTERNET" />

You can look here for a more detailed example:

HelloWorld, MapActivity

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文