开发者

Error integrating simple GoogleMaps app with core app

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> mapOv开发者_如何学Goerlays = 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}


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜