johannilsson/android-pulltorefresh

Listview on ItemClick gives wrong position

lakkad-amish opened this issue · 8 comments

When i click on item position it gives wrong position.for example i am clicking on position no 2 the it give the value of position 3.let me know how can i resolve this issue please

You can print the position in the method.Did you use the wrong param? the param type long or int ?

2014-01-16

Rakey Zhao

发件人:Amish Patel notifications@github.com
发送时间:2014-01-16 17:32
主题:[android-pulltorefresh] Listview on ItemClick gives wrong position (#76)
收件人:"johannilsson/android-pulltorefresh"android-pulltorefresh@noreply.github.com
抄送:

When i click on item position it gives wrong position.for example i am clicking on position no 2 the it give the value of position 3.let me know how can i resolve this issue please

Reply to this email directly or view it on GitHub.

01-16 16:21:38.635: I/System.out(11122): ------------ Position int ::1
01-16 16:21:38.635: I/System.out(11122): ------------ Position long ::48
01-16 16:21:38.635: I/System.out(11122): ------------ Product Id ::52
i have print log but on zero position it gives 1 poition

I believe this is by design since it is using a header view which will take up one position in the list. I believe your best option is to provide your own ids of the list that you feed through your adapter instead.

I didnt find this bug in my project , it runs well . Whats your OS version?
2014-01-17

Rakey Zhao

发件人:Amish Patel notifications@github.com
发送时间:2014-01-16 18:55
主题:Re: [android-pulltorefresh] Listview on ItemClick gives wrong position (#76)
收件人:"johannilsson/android-pulltorefresh"android-pulltorefresh@noreply.github.com
抄送:"rakey"benhare005@126.com

01-16 16:21:38.635: I/System.out(11122): ------------ Position int ::1
01-16 16:21:38.635: I/System.out(11122): ------------ Position long ::48
01-16 16:21:38.635: I/System.out(11122): ------------ Product Id ::52
i have print log but on zero position it gives 1 poition

Reply to this email directly or view it on GitHub.

Oh im sorry .I didnt use this widget in my project. I review the source. You are right. The auther used the position 0 as refresh view,. Then, set the selection at position 1 when the listView show . you can see the source. @OverRide protected void onAttachedToWindow() { super.onAttachedToWindow(); setSelection(1); //here } @OverRide public void setAdapter(ListAdapter adapter) { super.setAdapter(adapter); setSelection(1); // here override the method setAdapter }
My solution is very easy. In the method change the value of param
public void onItemClick(AdapterView<?> arg0, View view, int arg2,
long arg3) {
// arg2 is the position you can use (arg2 - 1)
}

2014-01-17

Rakey Zhao

发件人:Amish Patel notifications@github.com
发送时间:2014-01-16 17:32
主题:[android-pulltorefresh] Listview on ItemClick gives wrong position (#76)
收件人:"johannilsson/android-pulltorefresh"android-pulltorefresh@noreply.github.com
抄送:

When i click on item position it gives wrong position.for example i am clicking on position no 2 the it give the value of position 3.let me know how can i resolve this issue please

Reply to this email directly or view it on GitHub.

yes i find the way.i have write click event on view in adapter and remove listview onitemclick event.now its working good.

Are you American?

2014-01-20

Rakey Zhao

发件人:Amish Patel notifications@github.com
发送时间:2014-01-17 21:34
主题:Re: [android-pulltorefresh] Listview on ItemClick gives wrong position (#76)
收件人:"johannilsson/android-pulltorefresh"android-pulltorefresh@noreply.github.com
抄送:"rakey"benhare005@126.com

yes i find the way.i have write click event on view in adapter and remove listview onitemclick event.now its working good.

Reply to this email directly or view it on GitHub.

no my friend i am from india........