Reputation: 25
When a user click on an ACTV and finds what he is searching for, the only reason for him to select the ACTV again is to search for something else. I am looking for a way where when user has made a search in the ACTV and the search text is in the ACTV field (suggestions menu is closed) when the user clicks on the ACTV to write again, the current text to be highlighted or deleted on the click that opens the keyboard for the user to start typing their new search.
Upvotes: 1
Views: 1036
Reputation: 576
For highlighting:
android:selectAllOnFocus="true"
(xml attribute)
or
autoCompleteTextView.setSelectAllOnFocus(true);
(programmatically)
Upvotes: 2
Reputation: 319
Try this:
AutoCompleteTextView search = (AutoCompleteTextView) findViewById(R.id.search);
search.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Do what ever you want
(AutoCompleteTextView) findViewById(R.id.search).setText("");
}
});
Upvotes: 1