dialogplus icon indicating copy to clipboard operation
dialogplus copied to clipboard

.setOnItemClickListener((dialog1, item, view, position) returning wrong index

Open herghost opened this issue 10 years ago • 8 comments

I am using an custom adaptor and returning an arraylist of a custom class, when I am using adaptor.getItem(position); the position returned is 1 above the item selected. It looks like it is not taking into account that Arraylist is 0 indexed?

herghost avatar Sep 11 '15 15:09 herghost

Thanks for the feedback. Let me check this, I think someone else had the same issue before and was going to contribute, seems it's up to me now.

orhanobut avatar Sep 14 '15 07:09 orhanobut

Thanks for the reply, I will create a fork and take a look as well, hopefully get my head round it!

herghost avatar Sep 14 '15 09:09 herghost

That would be great!

orhanobut avatar Sep 14 '15 09:09 orhanobut

Actually I faced the same problem, but I solved it by using adapter extends from BasicAdapter, rather than ArrayAdapter .

Enjoy!

hammoudeh avatar Dec 30 '15 05:12 hammoudeh

ListView as default returns 1 if the list has headerview. If that was the case, I changed this behaviour with 1.1 version. GridHolder and ListHolder will return 0 regardless of headerview.

orhanobut avatar Jan 31 '16 14:01 orhanobut

Im sorry to say that GridHolder still returns the wrong index, for example, I got 6 items to display, and I create a GridHolder using new GridHolder(3). But when I click the second or the third item, I both got a position = 0;

thanks for your great work, but this bug is very upsetting

z3896823 avatar Jul 19 '17 15:07 z3896823

Yup. Same issue here. no matter what I click on the gridHolder, the item position is always 0. Also, the ripple effect appears on the first item no matter what I click.

ezgif-4-f79ec22ba3

shahimclt avatar Sep 12 '17 06:09 shahimclt

Update: As mentioned in issue #72 , this occurs when setExpanded() is set to true. making it false will fix the issue for now.

shahimclt avatar Sep 12 '17 06:09 shahimclt