Skip to content

Instantly share code, notes, and snippets.

@barmgeat
Last active September 15, 2018 00:48
Show Gist options
  • Save barmgeat/fed691d2e180212e855c8519d1acc349 to your computer and use it in GitHub Desktop.
Save barmgeat/fed691d2e180212e855c8519d1acc349 to your computer and use it in GitHub Desktop.
Insert Opration SQLite
public class MainActivity extends AppCompatActivity {
private HelperClass mHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mHelper = new HelperClass(this);
}
public insertData(){
SQLiteDatabase db = mHelper.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(Words.COLUMN_WORD, "Test Word");
values.put(Words.COLUMN_WORD_T, "Test T Word");
values.put(Words.COLUMN_WORD_T2, "Test T2 Word");
values.put(Words.COLUMN_WORD_T3, "Test T3 Word");
values.put(Words.COLUMN_ARTIKEL, Words.ARTIKEL_UNKNOWN);
long rowId = db.insert(Words.TABLE_NAME, null, values);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment