Android AppWidget maps activity problem

Posted by Andy Armstrong on Stack Overflow See other posts from Stack Overflow or by Andy Armstrong
Published on 2009-07-20T14:24:51Z Indexed on 2010/05/11 13:04 UTC
Read the original article Hit count: 392

Filed under:
|
|

Right.

So I have an app widget.

It has 4 buttons, one one of the buttons I want it to show me the current location of the user on the map.

So - I make a new activity as below:

package com.android.driverwidget;

import java.util.List;

import android.os.Bundle;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import com.google.android.maps.Overlay;



public class MyLocation extends MapActivity{



    	public void onCreate(Bundle icicle) {
		  super.onCreate(icicle);

		  setContentView(R.layout.main);

		  MapView myMapView = (MapView)findViewById(R.id.mapview);
		  MapController mapController = myMapView.getController();

		  List<Overlay> overlays = myMapView.getOverlays();
		  MyLocationOverlay myLocationOverlay = new MyLocationOverlay(this,             myMapView);
		  overlays.add(myLocationOverlay);
		  myLocationOverlay.enableMyLocation();
		}


		  protected boolean isRouteDisplayed() {

		    return false;
		  }




}

And then I added the appropriate uses library line to the manifest

<activity android:name=".MyLocation"
    android:label="myLocation">
     </activity>

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

Ok yet - when I run the app the following errors occur, looks like it cannot find the MapActivity class, im running it on the GoogleApps 1.5 instead of normal android 1.5 as well.

http://pastebin.com/m3ee8dba2

Somebody plz help me - i am now dying.

© Stack Overflow or respective owner

Related posts about android

Related posts about mapview