【问题标题】:Add overlay on stored Latitude and Longitude in a SQLite Database在 SQLite 数据库中存储的纬度和经度上添加覆盖
【发布时间】:2011-11-10 02:49:59
【问题描述】:

我已将位置的纬度和经度存储在 SQLite 数据库中,我将如何检索这些值并将它们分别放置在 OverlayItem 类中以在 Google 的地图代码中使用? 我得到了这个问题的答案 [1]:Get Latitude and Longitude from SQLite database for use in Android MapOverlay 这真的很有帮助,但我是 android 中的新手,无法理解很多事情,例如我应该在哪里执行此操作,在扩展 MapActivity 的类中或在 ItemizedOverlay强> 请任何人一步一步地解释它,这对所有学习者都有很大帮助。谢谢。

【问题讨论】:

    标签: android android-maps


    【解决方案1】:

    您想在 MapActivity 类中实现 ItemizedOverlay。见例子。

    public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.drawable.navup);      
    
            MapView mapView = (MapView) findViewById(R.id.mapview);
            mapView.setBuiltInZoomControls(true);
    
    // Get your GeoPoints from SQLLite and use them below for Longitude and Latitude
    
    GeoPoint point1 = new GeoPoint(latitude,longitude); 
    OverlayItem overlayitem1 = new OverlayItem(point1, "City", "State");
    List<Overlay> mapOverlays1 = mapView.getOverlays();
    Drawable drawable1 = this.getResources().getDrawable(R.drawable.map_pin);
    ClevelItemizedOverlay itemizedoverlay1 = new ClevelItemizedOverlay(drawable1, this);
    

    【讨论】:

      猜你喜欢
      • 2011-08-04
      • 1970-01-01
      • 1970-01-01
      • 2014-04-11
      • 2012-12-01
      • 2011-09-05
      • 1970-01-01
      • 2010-11-25
      • 1970-01-01
      相关资源
      最近更新 更多