谷歌地图用它的ID删除标记

时间:2016-02-07 02:43:36

标签: android google-maps google-maps-api-3

我有一张包含大量标记及其圈子的Google地图。我已经成功添加了标记和圈子并保存了他们的ID。但是删除标记很容易,但删除圆圈会产生问题,即使我有圆圈的ID是什么方法可以找到圆圈?

   like **googlemap.getCircle(id).remove();**

但是没有这样的方法所以我该怎么做?我正在考虑清除地图并再次添加所有标记和圆圈, 编辑 - 这是我的代码。

         String mid =  marker.getId();
            DataBaseOperations hell = new DataBaseOperations(getContext());
            SQLiteDatabase db = hell.getReadableDatabase();
            Cursor c = db.query(mDatabase.Table, new String[]{mDatabase.ID}, mDatabase.ID, new String[]{mid}, null, null, null);
            while(c.moveToNext()){
                String cid = c.getString(c.getColumnIndex(mDatabase.cid));
            }
            marker.remove();
            hell.close();
            db.close();
            c.close();

cid是Circle的ID,之前添加了如何使用它的id删除此圈子。

1 个答案:

答案 0 :(得分:1)

尝试使用circle_function对象删除您的圈子,如下所示:

Circle mapCircle{
//your circle method, 
//**example**
}

/* to remove your cirlce call remove() method**/
mapCircle.remove();