I am new to android development and I have a question about the insert method of the SQLiteDatabase class.
For example, if I want to insert one row, which has only one column, I would do the following:
SQLiteDatabase db = openHelper.getWritableDatabase();
ContentValues cv = new ContentValues();
cv.put("first_name", "my name");
db.insert("MyTable", null, cv);
The problem is that I don’t know how to use this insert method for two or more columns, for instance, if I wanted to add firstName and lastName. I know how to do that with the classic SQL syntax.
Use
You can put many pairs into ContentValues.