I'm new to android ... i have developed a Database application , were i'm able to insert the textfield details , but i want to delete the specific row , i need to search by name and delete the user.
can someone help me on this :
My DB code is:
public void deleteRow(String firstname)
{
try {db.delete(TABLE_NAME,TABLE_ROW_ONE + "=?" + new String[]{firstname},null);}
catch (Exception e)
{
Log.e("DB ERROR", e.toString());
e.printStackTrace();
}
}
Activty code is :
deleteButton.setOnClickListener ( new View.OnClickListener() { @Override public void onClick(View v) {deleteRow();} } );
private void deleteRow() { try {
db.deleteRow(textFieldOne.getText().toString());
updateTable();
emptyFormFields();
}
catch (Exception e)
{
Log.e("Delete Error", e.toString());
e.printStackTrace();
}
}
textFieldOne is the first name of the user.
can someone help me on this ..