将简单的 GoogleMaps 应用程序与核心应用程序集成时出错
我正在做我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想知道为什么要在 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.
您是否在 AndroindManifest.xml 文件中添加了 MapAcitivity?
您还需要将其包含在清单中:
您可以在此处查看更详细的示例:
HelloWorld,MapActivity
Did you add your MapAcitivity in your AndroindManifest.xml file?
You also need to include this in your manifest:
You can look here for a more detailed example:
HelloWorld, MapActivity