java - ViewPager not responding quickly -
while using viewpager noticed wouldn't respond quickly, meaning slows down when switchting through fragments, kind of in laggy way. does know how code causing issue?
public class list_adapter : baseadapter<element> { public list<element> _list; fragmentone _context; public list_adapter(fragmentone context, list<element> list) { super(context, list); _list = list; _context = context; } @override public int getcount() { return _list.size(); } @override public object getitem(int position) { return _list.get(position); } @override public long getitemid(int position) { return getitem(position).hashcode(); } @override public view getview(int position, view convertview, viewgroup parent) { layoutinflater inflater = (layoutinflater)getactivity().getapplicationcontext().getsystemservice(context.layout_inflater_service); view view = inflater.inflate(r.layout.row, parent, false); element item = getitem(position); textview lbl = (textview)view.findviewbyid(r.id.label); textview prop = (textview)view.findviewbyid(r.id.prop); lbl.settext(item.getlabel()); prop.settext(item.getprop()); return view; } }
- use viewholder pattern smooth list scrolling
- implement offscreen page limit initialising view before showing inside
viewpager
Comments
Post a Comment