I am using a pulltorefreshlistview how can i determine onitemclick for it, the current code i am using is not giving me right position.
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As already pointed out in a comment: you may be clicking on the first visible position on-screen, but that doesn’t mean there aren’t any hidden items or invisible headers that take up position 1 & 2.
Actually, after checking the source code of the pull-to-refresh implementation, it indeed adds at least one header.
One solution would be to offset the position in
OnItemClick(...)by the return value ofgetHeaderViewsCount()(and potentially some other count). However, it is probably easier and more fool-proof to just callgetItemAtPosition(...)with thepositionfromOnItemClickand cast the returned object to whatever you’re populating the ListView with.