How to limit items / inputs of a MultiAutoCompleteTextView

I have a MultiAutoCompleteTextView to select multiple recipients in a messaging app, but I just want to limit it to only two recipients or 3. The user should not be able to add more recipients after the limit is reached. Any hints how to do this?

final MultiAutoCompleteTextView mtv = (MultiAutoCompleteTextView) this
                    .findViewById(R.id.to);
            final MobilePhoneAdapter mpa = new MobilePhoneAdapter(this);
            final SharedPreferences p = PreferenceManager
                    .getDefaultSharedPreferences(this);
            MobilePhoneAdapter.setMobileNumbersOnly(p.getBoolean(
                    PreferencesActivity.PREFS_MOBILE_ONLY, false));
            mtv.setThreshold(2);
            mtv.setAdapter(mpa);
            ((MultiAutoCompleteTextView) mtv).setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
            mtv.setText(to);

      

+3
multiautocompletetextview


source to share


No one has answered this question yet

Check out similar questions:

46
Difference between MultiAutoCompleteTextView and AutoCompleteTextView
nine
How do I get a MultiAutoCompleteTextView tokenizer similar to the Facebook app?
3
How do I find the original position in the ArrayList that is suggested in the MultiAutoCompleteTextView?
2
How do I restrict the MultiAutoCompleteTextView values ​​to only the elements of my adapter?
1
MultiAutoCompleteTextView and Firebase
1
Android: Cannot select item in MultiAutoCompleteTextView added to Dialog
0
MultiAutocompleteTextView Events
0
Clear text of MultiAutoCompleteTextView after clicking tooltip item
0
MultiAutocompleteTextView input support for Android Unicode
-1
MultiAutoCompleteTextView shows wrong result



All Articles
Loading...
X
Show
Funny
Dev
Pics