android - how to change multiple text on button on button click and how to store that text in database -


this code text change, need know how change multiple text on button on button click , how store text in database. can help?

public void onbuttonclick(view v) {     btn3 = (button) v.findviewbyid(r.id.btn2);     if ( count==0) {         btn3.settext("a");         btn3.setbackgroundcolor(color.parsecolor("#e20d10"));         count = 1;     } else if (count == 1) {         btn3.settext("l");         btn3.setbackgroundcolor(color.parsecolor("#0d1be2"));         count = 2;             } 

to save value db follow code

  sqlitedatabase db; db=openorcreatedatabase("mydb",mode_private,null);  db.execsql("create table if not exists table(col_name varchar(20))"); db.execsql("insert table values("+bt3.gettext().tostring()+")"); 

Comments

Popular posts from this blog

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -