title: Negative id value in SQLite Android
body: <p>In the main activity I create database</p>
  
  <pre><code>class DBHelper extends SQLiteOpenHelper {
  
          public DBHelper(Context context) {
  
                 super(context, "myDB", null, 1);
          }
  
          @Override
          public void onCreate(SQLiteDatabase db) {
            db.execSQL("create table mytable ("
                    + "id integer primary key autoincrement," 
                    + "name text," 
                    + "obId text," 
                    + "latit text,"
                    + "long text" + ");");
          }
  
          @Override
          public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  
          }
        }
  </code></pre>
  
  <p>In the second activity I call the class of database</p>
  
  <pre><code>MainActivity myActivity = new MainActivity();
  dbHelper = myActivity.new DBHelper(myActivity);
  </code></pre>
  
  <p>And insert data</p>
  
  <pre><code>ContentValues cv = new ContentValues();
  db = openOrCreateDatabase("myDB.db", SQLiteDatabase.OPEN_READWRITE, null);
  cv.put("name", textViewName.getText().toString());
  long rowID = db.insert("mytable", null, cv);
  db.insert("mytable", null, cv);
  dbHelper.close();
  </code></pre>
  
  <p>The output "rowID" is "-1". I do not understand why this is happening</p>