Clear text of MultiAutoCompleteTextView after click of hint item

353 Views Asked by At

I am utilizing Multiautocompletetextview in my application. I have succesfully implemented the functionality however the issue is that whenever I click on the suggested item that I am choosing and return to the edit text to add another value to the list, the same text that is part of my past search still remains.

I would like for the text to be cleared after clicking on a given suggestion so that from there I dont have to manually delete the remenants of my past entry.

As the site android documentation describes my solution looks like so

    ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), simple_dropdown_item_1line, allGroups);
    MultiAutoCompleteTextView multiAutoCompleteTextView = view.findViewById(R.id.multiAutoCompleteTextView);
    multiAutoCompleteTextView.setAdapter(adapter);
    multiAutoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());

Not sure where to look into clicklistener as ive looked in the adapter and tokenizer to set to clear the text after click.

Appreciate the time and direction.

1

There are 1 best solutions below

2
Shahin On

Please Try the Code Below on your ClickListener,

Your_AutoCompleteText.setText("");