Reputation: 55
I am using a MultiAutoCompleteTextView to make suggestions from a list of names so that the user will enter in a valid name each time. The problem I encountered is that a user can enter in multiple names whereas, I want the user to only be able to enter in one name and then move onto the next form field. For example, if the two suggestions available are Joe Shmoe and John Doe, I want the only valid inputs to be "Joe Shmoe" or "John Doe" but not "Joe Shmoe, John Doe" or "John Doe, John Doe" as it is currently allowing. How can I make the focus move onto the next form field as soon as a user selects one of the suggestions?
Upvotes: 1
Views: 788
Reputation: 3180
First off, use the AutoCompleteTextView instead of MultiAutoCompleteTextView. The former restricts choosing only one item, whereas the later allows multiple choices.
Secondly, add an onItemClickListener to the AutoCompleteTextView, and in it's onItemClick implementation, set focus to the next field.
Upvotes: 2