开发者

Calling notifyDataSetChanged reversing the position's order, is this a bug?

I'm developing one android application in which I'm using one customized ListView which extends BaseAdapter, In which I have placed two TextView's and one button to delete the corresponding row from the list and also from the original data,

Whenever I call the notifyDataSetChanged() function the value of the position get reversed, am I doing anything wrong ?, Is there any other correct way to do this without the position get reversed ?

convertView.setOnClickListener(new OnClickListener() {

private int pos = position;

public void onClick(View v) {

Toast.makeText(context, "Click-" + String.valueOf(pos), Toast.LENGTH_SHORT)开发者_StackOverflow中文版.show();

}

});

holder.delete.setOnClickListener(new OnClickListener() {

public void onClick(View view) {

adapter.notifyDataSetChanged();

}

});

Any help will be appreciated.


Instead of on click for button in the every row in the list I just used context menu and performed the actions needed and updated the list and now its working.

Actually this is not the solution for my question and its just an alternative.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜