-1

I need to get index of the item from start. int position gives position of recycled view in listview. How do I get real item number in my ArrayList in getView(final int position, View convertView, ViewGroup parent) method.

Harshil Pansare
  • 1,117
  • 1
  • 13
  • 37
  • Use **tag** property, see this http://stackoverflow.com/questions/32045631/wrong-row-deleted-from-custom-listview-with-spinner for example. – AsfK Feb 14 '16 at 08:36

1 Answers1

0

You can get it by indexOf() method. See below code for example

ArrayList<String> mylist=new ArrayList<>();
mylist.add("I");
mylist.add("love");
mylist.add("You");
int index=mylist.indexOf("love");

Here, in index you will get 1. The position of content "love" in the ArrayList. And so on for all other contents.

Zahan Safallwa
  • 3,880
  • 2
  • 25
  • 32