问题描述
右键
所以我有一个应用程序部件。
So I have an app widget.
它有4个按钮,我想给我在地图上显示用户的当前位置的一个按钮之一。
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" />
尚未确定 - 当我运行出现以下错误的应用程序,貌似找不到MapActivity类,即时通讯上运行它的的GoogleApps 1.5,而不是正常的Android 1.5以及
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.
有人plz帮助我 - 现在我要死了。
Somebody plz help me - i am now dying.
推荐答案
修复您的清单中添加/移动
Fix your manifest by adding/moving
<uses-library android:name="com.google.android.maps" />
到应用的
这篇关于Android的AppWidget映射活动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!