I'm trying to build a Table of buttons in SQLite in android, everytime I open my app and looking at the DBBrowser the number of rows continuously incrementing, the total rows should be 47
//Menu.class
conn = new SQLiteDatabase(this);
if(conn.setInitializeTableButtons()){
Toast.makeText(getApplicationContext(), "DB READY", Toast.LENGTH_SHORT).show();
}
else {
Toast.makeText(getApplicationContext(), "DB FAILED", Toast.LENGTH_SHORT).show();
}
//SQLiteDatabase.class
public boolean setInitializeTableButtons() {
android.database.sqlite.SQLiteDatabase conn = this.getWritableDatabase();
contentValues = new ContentValues();
for (int i = 0; i < buttonNames.length; i++) {
contentValues.put(BUTTON_NAME, buttonNames[i]);
if (i == 0) {
contentValues.put(IS_UNLOCK, 1);
}
else{
contentValues.put(IS_UNLOCK, 0);
}
conn.insert(TABLE_BUTTONS, null, contentValues);
}
return true;
}