Android AppWidget地图活动问题
正确的。
所以我有一个应用程序小部件。
它有 4 个按钮,其中一个按钮我希望它能在地图上显示用户的当前位置。
所以 - 我创建了一个新活动,如下所示:
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;
}
}
然后我将适当的使用库行添加到清单中
<activity android:name=".MyLocation"
android:label="myLocation">
</activity>
<uses-library android:name="com.google.android.maps" />
还好 - 当我运行应用程序时,出现以下错误,看起来它找不到 MapActivity 类,我在 GoogleApps 上运行它1.5 也代替普通的 android 1.5。
请有人帮助我 - 我现在快死了。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
修复您的清单。
通过添加/移动到应用程序来
Fix your manifest by adding/moving
into application.
创建此项目时,您必须选择 Google APIs 项目,而不仅仅是 AVD。
When you creating this project you have to choose Google APIs project not only AVD.
您的问题可能与此错误有关:
http://groups.google .com/group/android-developers/msg/904fae350cda3ebc
You're problem might be related to this bug:
http://groups.google.com/group/android-developers/msg/904fae350cda3ebc