I am getting a list of names with ids from API. I am populating the names in an AutoCompleteTextView. But I want to get the corresponding ids also that are coming from API. Anyway to do it?
            Asked
            
        
        
            Active
            
        
            Viewed 58 times
        
    0
            
            
        - 
                    @pskink from server. – Prakhar Sep 15 '15 at 05:55
 - 
                    see [this](http://stackoverflow.com/a/19860624/2252830), then replace `c.newRow().add(i)` with `c.newRow().add(itemId)` where `itemId` comes from your API – pskink Sep 15 '15 at 05:56
 - 
                    ya but, again I need just the id of the item that the user has selected. If I do getTex(), I will get everything – Prakhar Sep 15 '15 at 06:00
 - 
                    you have `long id` parameter in `OnItemClickListener#onItemClick` – pskink Sep 15 '15 at 06:43
 - 
                    You can take a look at [my answer here](http://stackoverflow.com/questions/33047156/how-to-create-custom-baseadapter-for-autocompletetextview) for reference. Hope this helps! – BNK Oct 10 '15 at 14:13
 
1 Answers
0
            
            
        The best and the most modular approach to do this is by storing all the information regarding your selected item in a java model class. This way you will get all the information in a single java object and you can then use its getter methods to get the corresponding id. Here is an online tool to convert your json into a corresponding java setter and getter class.
        Kaveesh Kanwal
        
- 1,753
 - 17
 - 16