I use an ArrayAdapter on listview with convertview. But when it scrolls, there are some items duplicated. Could you please help me solve the problem? thanks main code of getView function:
View view;
if (null != convertView) {
view = convertView;
} else {
view = getActivity().getLayoutInflater().inflate(R.layout.item_fans_task, null);
taskImg = (ImageView) view.findViewById(R.id.task_img);
taskTitleText = (TextView) view.findViewById(R.id.task_title_text);
taskContentText = (TextView) view.findViewById(R.id.task_content_text);
taskProcessImg = (ImageView) view.findViewById(R.id.task_process_img);
shareText = (TextView) view.findViewById(R.id.share_text);
taskType = (TextView) view.findViewById(R.id.task_type);
}
Tasks task = getItem(position);
taskTitleText.setText(task.getTitle());
StringBuilder builder = new StringBuilder();
builder.append("已将文章分享到朋友圈,并获得" + task.getReaders() +"次阅读\n");
builder.append("已分享" + task.getTsum() + "次" + " 剩余" + task.getSynum() + "次" );
taskContentText.setText(builder);
...
return view;