Duplicate value issue in MultiAutoCompleteTextView

1.2k Views Asked by At

I am new to android development and i am using MultiAutoCompleteTextView in my APP and following is code.

public TextView autoSelected;
String[]    countries   =   {"India","USA","Canada","Indonesia","Belgium", "France", "Italy", "Germany", "Spain"};
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    MultiAutoCompleteTextView   autoCompleteTextView    =   (MultiAutoCompleteTextView)findViewById(R.id.autoCompleteTextView);     

    ArrayAdapter<String>    adapter     =   new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,countries);
    autoCompleteTextView.setAdapter(adapter);
    autoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());


}

First Problem and main problem TextView is getting duplicate values means same country is showing in TextView again and again. Example: i can select USA from autocomplete n number of times and it is showing n times in text field.

I want if i already selected specific value from suggestion, in that case either it should not visible in suggestions or it should not be visible in TextView.

Second issue

I want to customize design of selected values that are currently in TextView like with background and close sign attached to it.

0

There are 0 best solutions below