diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2012-12-17 12:27:00 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2012-12-17 12:27:00 +0100 |
| commit | aa801abe3aab9a891e3ba4d0fcb20aaca0b5959c (patch) | |
| tree | daae89056d6d9e8248043a0bffe8f8520222b2fe /main/src/cgeo/geocaching/cgData.java | |
| parent | e7b6124c9a211a43678f38f9a1eb094ac6c47c16 (diff) | |
| download | cgeo-aa801abe3aab9a891e3ba4d0fcb20aaca0b5959c.zip cgeo-aa801abe3aab9a891e3ba4d0fcb20aaca0b5959c.tar.gz cgeo-aa801abe3aab9a891e3ba4d0fcb20aaca0b5959c.tar.bz2 | |
Refactoring: simplify code
Diffstat (limited to 'main/src/cgeo/geocaching/cgData.java')
| -rw-r--r-- | main/src/cgeo/geocaching/cgData.java | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 5d4cddb..a490562 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -2206,7 +2206,7 @@ public class cgData { } try { - Cursor cursor = database.query( + final Cursor cursor = database.query( dbTableCaches, new String[]{"geocode"}, selection.toString(), @@ -2215,22 +2215,10 @@ public class cgData { null, "visiteddate", null); - - if (cursor != null) { - if (cursor.getCount() > 0) { - cursor.moveToFirst(); - int index = cursor.getColumnIndex("geocode"); - - do { - geocodes.add(cursor.getString(index)); - } while (cursor.moveToNext()); - } else { - cursor.close(); - return null; - } - - cursor.close(); + while (cursor.moveToNext()) { + geocodes.add(cursor.getString(0)); } + cursor.close(); } catch (Exception e) { Log.e("cgData.loadBatchOfHistoricGeocodes: " + e.toString()); } |
