Skip to content

Instantly share code, notes, and snippets.

@markojerkic
Created April 22, 2017 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markojerkic/3c770849264a80a5d6e4c8d6fd262d05 to your computer and use it in GitHub Desktop.
Save markojerkic/3c770849264a80a5d6e4c8d6fd262d05 to your computer and use it in GitHub Desktop.
Create of CRUD
public void put(DatabaseHelper mDbHelper, String value1, String value2) {
// Gets the database in write mode
SQLiteDatabase db = mDbHelper.getWritableDatabase();
//Content values store the date you want to put into the database
//Content values connect the value with the column
ContentValues values = new ContentValues();
values.put(FeedEntry.COLUMN_NAME1, value1);
values.put(FeedEntry.COLUMN_NAME1, value2);
// Insert the new row, returning the primary key value of the new row
long newRowId = db.insert(FeedEntry.TABLE_NAME, null, values);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment