I follow this guide to clear edit field when enter Clear text in EditText when entered
But I have to click 2 times for clearing the edit field.
Here is the code:
public class Trackfolio extends Activity implements OnClickListener {
/**
* Called when the activity is first created.
*/
public EditText editText;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
editText = (EditText) findViewById(R.id.editText1);
editText.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
editText.setText("");
}
}
My question is how to clear the edit text in only one click?
I really appreciate your helps. Thank you very much in advanced.