arraylistmultiautocompletetextview

How to find original position of item in ArrayList which is suggested in MultiAutoCompleteTextView?


I applied auto suggest operation on arraylist through MultiAutoCompleteTextView. When I click on suggested list I get the position of item as per suggested list but I want position of item as per items saved in arraylist. One way to get the position is

 int position=arrayList.indexOf(item); 

But there may be possible duplicate items in the arraylist.How do I get the actual index from arraylist?


Solution

  • Use values model and save one unique string per row, for e.g.,

        ArrayList<Person> listPerson=new ArrayList<Person>;             
        listPerson.add(new Person("AbcName","uniqueKey1")); 
        listPerson.add(new Person("AbcName","uniqueKey2"));