android - ListView items repeat in BaseAdapter -
i'm pulling data , loading baseadapter list view. currently, items in listview same last item added, list looks this:
item 3 item 3 item 3
instead of:
item 1 item 2 item 3
i've checked on data sources, , data that's loaded source unique each time. think there's somehting wrong baseadapter, i'm not sure is. here's baseadapter:
baseadapter.java
arraylist<threadlistdata> mylist = new arraylist<>(); layoutinflater inflater; context context; public threadbaseadapter(context context, arraylist<threadlistdata> mylist) { this.context = context; inflater = layoutinflater.from(this.context); this.mylist = mylist; } @override public int getcount() { return mylist.size(); } @override public threadlistdata getitem(int position) { return mylist.get(position); } @override public long getitemid(int position) { return 0; } @override public view getview(int position, view convertview, viewgroup parent) { if (convertview == null) { layoutinflater inflater = layoutinflater.from(this.context); convertview = inflater.inflate(r.layout.listitem_newthread, parent, false); } threadlistdata listdata = getitem(position); textview name = (textview)convertview.findviewbyid(r.id.name_newthread); textview username = (textview)convertview.findviewbyid(r.id.username_newthread); name.settext(listdata.getname()); username.settext(listdata.getname()); parseimageview profile = (parseimageview)convertview.findviewbyid(r.id.profilepicture); bitmaptask task = new bitmaptask(listdata.getimage()); task.execute(profile); return convertview; }
i'll start baseadapter, , can show more code if requested. appreciated!
you missed return position
modifiy getitemid
as
@override public long getitemid(int position) { return position; }
Comments
Post a Comment