how to combine multiple rows into one row with same column value v1 in android -
view_id
, mac_qr_code
common in multiple rows button_id
different. want when retrieving view_id
should treated single v1
, on image click event view 3 button_id
.
insert query
public void insertdata(string view_id, string button_id, string publish_topic, string subscribe_topic, byte[] image, string qr_code){ sqlitedatabase database = getwritabledatabase(); string sql = "insert config values (null, ?, ?, ?, ?, ?, ?)"; sqlitestatement statement = database.compilestatement(sql); statement.clearbindings(); statement.bindstring(1, view_id); statement.bindstring(2, button_id); statement.bindstring(3, publish_topic); statement.bindstring(4, subscribe_topic); statement.bindblob(5, image); statement.bindstring(6, qr_code); statement.executeinsert(); }
get data sqlite
// data sqlite cursor cursor =sqlitehelper.getdata("select * config"); getadapter1.clear(); while (cursor.movetonext()) { int id = cursor.getint(0); string view_id = cursor.getstring(1); string button_id = cursor.getstring(2); byte[] image = cursor.getblob(5); getadapter1.add(new getadapter(view_id, button_id, image, id)); }
Comments
Post a Comment