简体   繁体   中英

Insert Data into Android SQLite Database

This code doesn't show any error during compiletime or runtime but the values is not get inserted to database. Please guide me I was new to android programing field. This code doesn't show any error during compiletime or runtime but the values is not get inserted to database.

ContentValues values=new ContentValues();
                values.put("username",u_name);
                values.put("password", pass);
                db.insert("login", null, values);

you are not calling the regs() function. call it like

   public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.reg);
    regs();
}

and change the regs() function signature to

public void regs(View v){ 

to

public void regs(){

since you are not using v variable of View

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM