-2

How to retrieve position of an element from a custom adapter based on element name.. I have a cityAdapter that contains city name and id in key value format. I am trying to retrieve position by the following code

SpinnerModel model=new SpinnerModel();
            model.setKey(""+currentLocation);
            model.setValue(currentLocationValue);
            int position = cityAdapter.getPosition(model);

Position is returning as -1. Can any one please guide me how to solve the issue.

Debdutta
  • 25
  • 6

1 Answers1

0

You can easily get position of a particular item on click of a list, is there any particular reason so that you don't want to get item position on list click?

Suchi
  • 116
  • 1
  • 11