android - Why is the Cursor set to 0 position after clicking button in ListView -
when click button cursor position changed 0 in onclick()
function.
in debug can see cursor.getposition()
returns correct position when outside onclick()
inside function gives me position 0.
it if jumps top of screen screen element don't move.
here onclick()
function use inside binview
in cursoradapater
listview
:
viewholder.buttoniav.setonclicklistener( new view.onclicklistener() { @override public void onclick(view v) { //int position = cursor.getposition(); log.d("cursor position2", string.valueof(position)); boolean isselected = selectionarray.get(position); log.d("is true2", string.valueof(isselected)); if(!isselected) { viewholder.artextv.setvisibility(v.invisible); setselected(position, true); } else if (!isselected){ viewholder.artextv.setvisibility(v.visible); setselected(position, false); } } } );
why behavior?
try before clicking in bind view
c.movetoposition(position);
Comments
Post a Comment