title: problems with my SQLiteOpenHelper
body: <pre><code>package com.owen.quartergames.dao;
  
  import java.io.InputStream;
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.DocumentBuilderFactory;
  
  import org.w3c.dom.Document;
  import org.w3c.dom.NodeList;
  
  import android.content.ContentValues;
  import android.content.Context;
  import android.database.Cursor;
  import android.database.sqlite.SQLiteDatabase;
  import android.database.sqlite.SQLiteOpenHelper;
  import android.util.Log;
  import android.widget.Toast;
  
  import com.owen.quartergames.R;
  import com.owen.quartergames.domain.LogEntry;
  
  public class SqlLiteFishLoggerDao extends SQLiteOpenHelper implements
          FishLoggerDao {
  
      private static final String DB_NAME = "fishingLog";
  
      private static final String TABLE_NAME = "LogEntries";
  
      private static final String DELETE_LOG_ENTRY_SQL = "DELETE FROM LogEntries WHERE _id = ?;";
  
      private static final String FIND_LOG_ENTRY_SQL = "SELECT _id, Longitude, Latitude FROM LogEntries WHERE _id = ?";
  
      private static final String FIND_ALL_ENTRIES_SQL = "SELECT * FROM LogEntries";
  
      private static final String[] NO_ARGS = {};
  
      private Context context;
  
      private final SQLiteDatabase db = getWritableDatabase();
  
      public SqlLiteFishLoggerDao(Context context) {
          super(context, DB_NAME, null, 1);
          this.context = context;
      }
  
      @Override
      public void deleteLogEntry(String id) {
          id = "0";
  
          db.execSQL(DELETE_LOG_ENTRY_SQL, new Object[] { id });
          // int deleted = db.delete(TABLE_NAME, "_id = ?",
          // new String[] { id.trim() });
          // Log.i("fishlogger", String.format("Delete %d rows", deleted));
          db.close();
      }
  
      @Override
      public LogEntry findEntry(String id) {
          Cursor cursor = db.rawQuery(FIND_LOG_ENTRY_SQL, new String[] { id });
          if (!cursor.moveToFirst()) {
              return null;
          }
  
          LogEntry entry = new LogEntry();
          entry.setId(id);
          entry.setLatitude(cursor.getDouble(cursor.getColumnIndex("Latitude")));
          entry
                  .setLongitude(cursor.getDouble(cursor
                          .getColumnIndex("Longitude")));
          cursor.close();
          db.close();
          return entry;
  
      }
  
      @Override
      public void insertLogEntry(LogEntry entry) {
          ContentValues values = new ContentValues();
          values.put("Latitude", entry.getLatitude());
          values.put("Longitude", entry.getLongitude());
          values.put("PictureURL", entry.getPictureUrl());
          values.put("SizeOrWeight", entry.getSizeOrWeight());
          values.put("CreateDate", entry.getEntryDate());
          values.put("Species", entry.getSpecies());
          db.insertOrThrow("LogEntries", null, values);
          db.close();
      }
  
      @Override
      public void onCreate(SQLiteDatabase db) {
          String s;
          try {
              Toast.makeText(context, "1", 2000).show();
              InputStream in = context.getResources().openRawResource(R.raw.sql);
              DocumentBuilder builder = DocumentBuilderFactory.newInstance()
                      .newDocumentBuilder();
              Document doc = builder.parse(in, null);
              NodeList statements = doc.getElementsByTagName("statement");
              for (int i = 0; i &lt; statements.getLength(); i++) {
                  s = statements.item(i).getChildNodes().item(0).getNodeValue();
                  db.execSQL(s);
              }
          } catch (Throwable t) {
              Toast.makeText(context, t.toString(), 50000).show();
          }
          Log.e("DB", "DB Created");
  
      }
  
      @Override
      public List&lt;LogEntry&gt; findAllEntries() {
  
          List&lt;LogEntry&gt; entries = new ArrayList&lt;LogEntry&gt;();
  
          Cursor cursor = db.rawQuery(FIND_ALL_ENTRIES_SQL, NO_ARGS);
  
          int entryDateCol = cursor.getColumnIndex("CreateDate");
          int speciesCol = cursor.getColumnIndex("Species");
          int sizeCol = cursor.getColumnIndex("SizeOrWeight");
          int latCol = cursor.getColumnIndex("Latitude");
  
          if (cursor.moveToFirst()) {
              do {
                  LogEntry entry = new LogEntry();
                  entry.setEntryDate(cursor.getString(entryDateCol));
                  entry.setSpecies(cursor.getString(speciesCol));
                  entry.setSizeOrWeight(cursor.getString(sizeCol));
                  entry.setLatitude(cursor.getDouble(latCol));
  
                  if (entry.getSpecies() == null) {
                      entry.setSpecies("Not Entered");
                  }
  
                  if (entry.getSizeOrWeight() == null) {
                      entry.setSizeOrWeight("Not entered");
                  }
  
                  entries.add(entry);
              } while (cursor.moveToNext());
          }
          cursor.close();
          db.close();
          return entries;
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase DB, int oldVersion, int newVersion) {
          db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
          onCreate(getWritableDatabase());
      }
  }
  </code></pre>
  
  <p>basically the delete doesnt work however i think the problems stems from the findAllEntries() method.  the reason i say that is that i get "leak found" errors in log cat saying the db was created but never closed.  i have throughly searched the internet and have asked friends who code but no luck in solving the problem.  all my cursors are closed and from what i can tell this is how a sqlliteopenhelper should generally look like. </p>
  
  <p>thanks for any responses </p>