title: Ormlite setup without using base activities
body: <p>I'm using <a href="http://ormlite.com/">ORMLite</a> in an android project, and I'm not wanting to use the extended activities because I'm inserting values into the database on an AsyncTask.</p>
  
  <p>In the docs it says:</p>
  
  <p>"If you do not want to extend the <code>OrmLiteBaseActivity</code> and other base classes then you will need to duplicate their functionality. You will need to call <code>OpenHelperManager.getHelper(Context context, Class openHelperClass)</code> at the start of your code, save the helper and use it as much as you want, and then call <code>OpenHelperManager.release()</code> when you are done with it."</p>
  
  <p>It also says to add the database helper class in the <code>strings.xml</code>, which I have.  So I'm not sure what I'm doing wrong.</p>
  
  <p>I'm using a class called <code>DataAccess</code> for my data tier that looks like this:</p>
  
  <pre><code>public class DataAccess {
      private Context context;
      private DBHelper dbHelper;
  
      public DataAccess(Context _context) {
          this.context = _context;
          dbHelper = getDBHelper(_context);
      }
  
      private DBHelper getDBHelper(Context context) {
          if (dbHelper == null) {
              dbHelper = (DBHelper) OpenHelperManager.getHelper(context, DBHelper.class);
          }
          return dbHelper;
      }
  }
  </code></pre>
  
  <p>And I'm using the extended helper class:</p>
  
  <pre><code>public class DBHelper extends OrmLiteSqliteOpenHelper {
      private static final String DATABASE_NAME = "database.db";
      private static final int DATABASE_VERSION = 1;
  
      private Dao&lt;SomeObject, Integer&gt; someObjectTable = null;
      private ConnectionSource connectionSource = null;
  
      public DBHelper(Context context) {
          super(context, DATABASE_NAME, null, DATABASE_VERSION);
      }
  
      @Override
      public void onCreate(SQLiteDatabase db, ConnectionSource connectionSource) {
          this.connectionSource = connectionSource;
          try {
              TableUtils.createTable(connectionSource, SomeObject.class);
          } catch (SQLException e) {
              throw new RuntimeException(e);
          }
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion) {
      }
  
      public Dao&lt;SomeObject, Integer&gt; getSomeObjectDao() throws SQLException {
          if (someObjectTable == null) {
              dateTable = getDao(SomeObject.class);
          }
          return someObjectTable;
      }
  </code></pre>
  
  <p>The idea is to create the <code>DataAccess</code> class and have it create the <code>DBHelper</code> if it hasn't already.</p>
  
  <p>Can someone tell me if this is right or wrong, or if I'm on the right path?</p>
  
  <p>Thanks!</p>