From 041c7c76027a51497ae36cb80bb4a24c62b32157 Mon Sep 17 00:00:00 2001 From: Georg Lukas Date: Mon, 13 Dec 2010 16:50:25 +0100 Subject: [PATCH] optimize db access --- src/MapAct.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MapAct.scala b/src/MapAct.scala index 76d322f..e42f41f 100644 --- a/src/MapAct.scala +++ b/src/MapAct.scala @@ -113,7 +113,8 @@ class StationOverlay(icons : Drawable) extends ItemizedOverlay[Station](icons) { } def loadDb(db : StorageDatabase) { - val c = db.getPositions(null, null, "100") + stations.clear() + val c = db.getPositions(null, null, null) c.moveToFirst() while (!c.isAfterLast()) { val call = c.getString(c.getColumnIndexOrThrow(StorageDatabase.Position.CALL)) @@ -125,6 +126,8 @@ class StationOverlay(icons : Drawable) extends ItemizedOverlay[Station](icons) { c.moveToNext() } c.close() + setLastFocusedIndex(-1) + populate() Log.d("StationOverlay", "total %d items".format(size())) } @@ -133,7 +136,6 @@ class StationOverlay(icons : Drawable) extends ItemizedOverlay[Station](icons) { // return //calls.add(sta.getTitle(), true) stations.add(sta) - populate() } def addStation(post : String) {