"I have store 0 in Database now I want to update the status through
updateStatus()
when button is clicked.I am not sure that the query I have
written is correct and I have no idea how to use UpdateStatus()
."
"onClick()
contains 5 buttons. e.g if the button btn_AllCalls
is pressed then the status should be updated to var where var is the status I want to update.
but I have no idea how to do this.
onclick()
function is used in another activity.
GetButton
is Getters and Setter."
updateStatus(GetButton getButton){
try {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues content = new ContentValues();
content.put(STATUS, getButton.getStat());
db.update(ACTIVETABLE,content,"STATUS = ?",null);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
onClick(View view) {
switch(view.getId()) {
case R.id.btn_AllCalls:
var = 1;
break;
case R.id.btn_SpecificContactNumbers:
var = 2;
break;
case R.id.btn_UserInput:
var = 3;
break;
case R.id.btn_UnknownNumbers:
var = 4;
break;
case R.id.btn_SavedContacts:
var = 5;
break;
}
}