hi i have a form in my xml with all infos and i wanna create a button to update some elements (one button for one element....) my code is :
private int id;
private String surnom;
public int getid()
{ return id; }
public void setId(int id)
{ this.id = id; }
public String getsurnom()
{ return surnom; }
public void setsurnom(String surnom)
{ this.surnom = surnom; }
public void addListenerOnButton00() {
button = (Button) findViewById(R.id.bouton00);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
String packageName = context.getPackageName();
String DB_PATH = String.format("//data//data//%s//databases//", packageName);
String path = DB_PATH + DB_NAME;
database = SQLiteDatabase.openDatabase(path, null,
SQLiteDatabase.OPEN_READWRITE);
Log.e(this.getClass().toString(), "Opening database for update");
ContentValues values=new ContentValues();
values.put("surnom",getsurnom());
database.update("mabase", values, "_id=" + id, null);
database.close();
Log.e(this.getClass().toString(), "closing database after update");
}
});
}
i have no errors when i click the button but nothing is updated can you help me?
logs are here to make me see on logcat that code is well executed.