How can I create a button which resets/deletes all text in an EditText.
This is some code I’ve written:
private View.OnClickListener onRes =new View.OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
// Here i wanna put some code to clear the EditText
}
};
I don’t have any idea how to do that.
If you have more than one
EditText, something like a form and you would like to have a reset button that resets all fields then I suggest you create anArrayListwhich holds all yourEditTextwidgets.Once your reset button is pressed just iterate over the list and clear every field. Here is an example: