title: GetReadableDatabase error android
body: <p>I created a DBTest class SQLiteOpenHelper</p>
  
  <p>Then I called this from my main UI.</p>
  
  <p>It crashes when I hit the DB.GetReadableDatabase () and the log is no help, just says null pointer, but I don't know where to look.</p>
  
  <p>Everything works if I use </p>
  
  <pre><code>SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
  </code></pre>
  
  <p>Same database</p>
  
  <p>Here is the Class for the helper and below the error:</p>
  
  <pre><code>   public class DBTest extends SQLiteOpenHelper {
  
              private static String DB_NAME = "DB";
  
              private SQLiteDatabase myDataBase; 
  
              private final Context myContext;
  
              public DBTest(Context context) {
  
                  super(context,   DB_NAME, null, 1);
                  this.myContext = context;
              }
  
              @Override
              public void onCreate(SQLiteDatabase db) {
                  // TODO Auto-generated method stub
  
              }
  
              @Override
              public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
                  // TODO Auto-generated method stub
  
              }
      }
  </code></pre>
  
  <p>Below is where the error happens:</p>
  
  <pre><code>public class Main extends Activity 
  {
  
      DataBaseHelper db = new DataBaseHelper(null);
      static SQLiteDatabase Db;
  
  
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          SQLiteDatabase Db;
  
          DBTest db1 = new DBTest(null);
  
          Db = db1.getReadableDatabase(); &lt;&lt;&lt;  blow up here
  
  
          }
  }
  </code></pre>