-1

我试图用 pindrops 填充西雅图的区域,当按下时会提供信息,但我试图避免对每个 pindrop 进行硬编码。我认为用信息填充数据库(SQLite)并拥有一种自动将信息转换为 pindrop 的方法是最简单的,但我想确认这一点。

这是一个非常模糊的问题,我只是想找人给我指出一个好的方向,因为我碰壁了。我该怎么办?SQLite 会是最简单的解决方案吗?有没有更简单的方法?谢谢!!

4

3 回答 3

1

我认为用 ContentProvider 包装的 SQLite 数据库将是您最好的选择。如果您(将)拥有的坐标是纬度,那么只需将它们转换为地图上的标记就很容易了。还取决于您计划使用的地图。

对于 Google Maps API,它很简单:

// When CursorLoader finishes it calls onLoadFinished, there loop the returned data
// Table columns: float latitude, float longitude, String marker title
if (cursor.moveToFirst()) {
    for (int i=0; i<cursor.getCount(); i++ ) {
        mMap.addMarker(new MarkerOptions()
                .position(new LatLng(cursor.getFloat(0), cursor.getFloat(1)))
                .title(cursor.getString(2))
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.marker)));
    }
}
于 2014-08-05T21:09:55.767 回答
1

低于 50 代表,所以我无法发表评论,因此在这里。

您可以在 html 中创建图钉放置点。任何数据库都应该工作。只需将所有点作为数组或 json 获取,并将其与循环函数中的适当 html 结合起来。

//编辑// 我刚刚注意到你标记了 android。划掉 html 评论并检查一下 https://developers.google.com/maps/documentation/android/marker

于 2014-08-05T21:00:55.000 回答
0

是的,使用 sqlite 将是一个比将其硬编码到应用程序中更好的选择。然后,您可以使用 PHP 从 sqlite 数据库中读取数据,并使用 google maps api 或任何您喜欢的方式将其显示在页面上。

于 2014-08-05T21:07:33.823 回答