title: Why can't I insert more than one table into one database in SQLiteDatabase browser
body: <p>I can't seem to insert multiple tables into one database. Plus, I've followed this example <a href="https://stackoverflow.com/questions/4063510/multiple-table-sqlite-db-adapters-in-android">Multiple Table SQLite DB Adapter(s) in Android?</a>.</p>
  
  <p>I am not sure on what to code in the Cars.java, Cycles.java and Boats.java classes. I am also not sure on which DBAdapter to declare in those 3 classes. I've managed to create database for 3 tables. But no tables are created.</p>
  
  <p>This is CarsDBAdapter class and is similar to BoatsDBAdapter and CyclesDBAdapter classes.</p>
  
  <pre><code>public class CarsDBAdapter
  {
      public static final String ROW_ID = "_id";
      public static final String NAME = "name";
      public static final String MODEL = "model";
      public static final String YEAR = "year";
  
      private static final String DATABASE_TABLE = "cars";
  
      private DatabaseHelper mDbHelper;
      private SQLiteDatabase mDb;
  
      private final Context mCtx;
  
      private static class DatabaseHelper extends SQLiteOpenHelper
      {
          DatabaseHelper(Context context)
          {
              super(context, DBAdapter.DATABASE_NAME, null, DBAdapter.DATABASE_VERSION);          
          }
  
          @Override
          public void onCreate(SQLiteDatabase db)
          {           
          }
  
          @Override
          public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
          {           
          }
      }// end DatabaseHelper class
  
      public CarsDBAdapter(Context ctx)
      {
          this.mCtx = ctx;
      }
  
      public CarsDBAdapter open() throws SQLException
      {
          this.mDbHelper = new DatabaseHelper(this.mCtx);
          this.mDb = this.mDbHelper.getWritableDatabase();
          return this;
      }
  
      public void close()
      {
          this.mDbHelper.close();
      }
  
      /*public long insertCars(String name, String model, String year)
      {
          ContentValues initialValues = new ContentValues();
          initialValues.put(NAME, name);
          initialValues.put(MODEL, model);
          initialValues.put(YEAR, year);
          return mDb.insert(DATABASE_TABLE, null, initialValues);
      }*/
  
      public long create(String name, String model, String year)
      {
          ContentValues initialValues = new ContentValues();
  
          initialValues.put(NAME, name);
          initialValues.put(MODEL, model);
          initialValues.put(YEAR, year);
          return this.mDb.insert(DATABASE_TABLE, null, initialValues); 
      }
  
      public boolean deleteCar(long rowId) 
      {          
          return this.mDb.delete(DATABASE_TABLE, ROW_ID + "=" + rowId, null) &gt; 0; //$NON-NLS-1$     
      }
  
       public Cursor getAllCars() 
       {          
           return this.mDb.query(DATABASE_TABLE, new String[] { ROW_ID, NAME, MODEL, YEAR }, null, null, null, null, null);       
       }
  
       public Cursor getCar(long rowId) throws SQLException
       {
           Cursor mCursor = this.mDb.query(true, DATABASE_TABLE, new String[] {ROW_ID, NAME, MODEL, YEAR}, ROW_ID + "=" + rowId,
                   null, null, null, null, null);
  
           if(mCursor != null)
           {
               mCursor.moveToFirst();
           }
  
           return mCursor;
       }
  
       public boolean updateCar(long rowId, String name, String model, String year)
       {
           ContentValues args = new ContentValues();
  
           args.put(NAME, name);
           args.put(MODEL, model);
           args.put(YEAR, year);
           return this.mDb.update(DATABASE_TABLE, args, ROW_ID + "=" + rowId, null) &gt;0;  
       }
  
  }//end CarsDBAdapter class
  </code></pre>
  
  <p>This is the DBAdapter where I create the 3 tables:</p>
  
  <pre><code>public class DBAdapter
  {
      public static final String DATABASE_NAME = "stuffIOwn";
      public static final int DATABASE_VERSION = 2;
  
      private static final String CREATE_TABLE_CARS = "create table cars(_id integer primary key autoincrement, " //$NON-NLS-1$
              +CarsDBAdapter.NAME+ " TEXT," //$NON-NLS-1$
              +CarsDBAdapter.MODEL+ " TEXT," //$NON-NLS-1$
              +CarsDBAdapter.YEAR+ " TEXT" +");"; //$NON-NLS-1$
  
      private static final String CREATE_TABLE_BOATS = "create table boats(_id integer primary key autoincrement, " //$NON-NLS-1$
              +BoatsDBAdapter.NAME+ " TEXT," //$NON-NLS-1$
              +BoatsDBAdapter.MODEL+ " TEXT," //$NON-NLS-1$
              +BoatsDBAdapter.YEAR+ " TEXT" +");"; //$NON-NLS-1$
  
      private static final String CREATE_TABLE_CYCLES = "create table cycles(_id integer primary key autoincrement, " //$NON-NLS-1$
              +CyclesDBAdapter.NAME+ " TEXT," //$NON-NLS-1$
              +CyclesDBAdapter.MODEL+ " TEXT," //$NON-NLS-1$
              +CyclesDBAdapter.YEAR+ " TEXT" +");"; //$NON-NLS-1$
  
      private final Context context;
      private DatabaseHelper DBHelper;
      private SQLiteDatabase db;
  
      public DBAdapter(Context ctx)     
      {         
          this.context = ctx;         
          this.DBHelper = new DatabaseHelper(this.context);     
      }
  
      private static class DatabaseHelper extends SQLiteOpenHelper      
      {         
          DatabaseHelper(Context context)          
          {             
              super(context, DATABASE_NAME, null, DATABASE_VERSION);         
              }          
          @Override         
          public void onCreate(SQLiteDatabase db)          
          {             
              db.execSQL(CREATE_TABLE_CARS);             
              db.execSQL(CREATE_TABLE_BOATS);             
              db.execSQL(CREATE_TABLE_CYCLES);                   
          }          
          @Override         
          public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)          
          {                            
              // Adding any table mods to this guy here         
          }     
      }//end DatabaseHelper class
  
      public DBAdapter open() throws SQLException      
      {         
      this.db = this.DBHelper.getWritableDatabase();         
      return this;     
      }      
      /**      
       * close the db 
       *return type: void      
       */    
      public void close()      
      {        
          this.DBHelper.close();     
      }
  </code></pre>
  
  <p>THis is Cars.java class and it's similar to Cycles.java &amp; Boats.java classes.</p>
  
  <pre><code>public class Cars extends Activity
  {
      final Context context = this;
  
       /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) 
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.cars);
  
          CarsDBAdapter carsDB = new CarsDBAdapter(this);
  
          //DBAdapter dbA = new DBAdapter(this);
  
          /*carsDB.open();
          long id;
          id = carsDB.insertCars("Mercedes", "MERCDS", "2000");
          id = carsDB.insertCars("BMW", "BMWTO", "1999");
          carsDB.close();*/
  
          carsDB.open();
  
          Cursor c = carsDB.getAllCars();
          if (c.moveToFirst())
          {
              do
              {
                  DisplayContact(c);
              } while (c.moveToNext());
          }
  
          carsDB.close();
  
          Button btnMenu = (Button) findViewById(R.id.btnMenu);
          btnMenu.setOnClickListener(new View.OnClickListener()
              {
  
                  @Override
                  public void onClick(View v)
                  {
                      Intent menuIntent = new Intent(context, VehiclesMenu.class);
                      startActivity(menuIntent);
  
                  }
              });
      }//end onCreate()
  
      public void DisplayContact(Cursor c)
      {
          Toast.makeText(
                  this,
                  "id: " + c.getString(0) + "\n" + "Name: " + c.getString(1)
                          + "\n" + "Model:  " + c.getString(2) + "\n" + "Year: " + c.getString(3),  Toast.LENGTH_LONG)
                  .show();
      }
  </code></pre>
  
  <p>I really need help with this. Any help will be appreciated. </p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I've added in the codes but you can look at the link above. It links to the example which I followed.</p>