Friday 15 February 2013

android - Custom ArrayAdaptor only calls getView once -



android - Custom ArrayAdaptor only calls getView once -

the issue i'm having getview beingness called once. tried prepare overriding getcount, can verify correctly returning 2.

i've seen several similar posts on here, of fixes had overriding getcount, have done.

i know isn't issue setting listview's adaptor because displaying 1 item. know isn't issue layout of items because getview beingness called once.

public class postadapter extends arrayadapter<parseobject> { private final context context; private final parseobject[] values; public postadapter(context context, parseobject[] values) { super(context, r.layout.post_item, values); this.context = context; this.values = values; } @override public view getview(int position, view convertview, viewgroup parent) { layoutinflater inflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service); view rowview = inflater.inflate(r.layout.post_item, parent, false); //do stuff homecoming rowview; } @override public int getcount() { homecoming values.length; } }

am missing info perchance stop working?

edit: here code set adaptor

postadapter adapter = new postadapter(activity, parseobjects.toarray(new parseobject[0])); ((listview) activity.findviewbyid(r.id.postlist)).setadapter(adapter); adapter.notifydatasetchanged();

android android-arrayadapter

No comments:

Post a Comment