Generally
You can achieve what you want to do by using the onFocus combination and clearing the text field, similar to what the two commentators have already suggested under your post. The solution will look like this:
EditText myEditText = (EditText) findViewById(R.id.myEditText); myEditText.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) {
Please always use TextKeyListener to βclearβ EditText, you can avoid a lot of android warnings in the log this way.
But...
I would rather recommend that you simply install the following in xml:
<EditText android:selectAllOnFocus="true"/>
As described here . Thus, your user has a much better UI feeling, he or she can independently decide what to do with the text, and will not be annoyed because it is cleared every time!
source share