android - Check generated ListView time -
i know how can track time spent draw/populate list view. using custom array adapter using list. thinking of using system.nanotime()
.
i tried following code:
@override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { long startnano = system.nanotime(); view view = inflater.inflate(r.layout.trip_listview, container, false); listview lv = (listview) view.findviewbyid(android.r.id.list); tripsarrayadapter tripsarrayadapter = new tripsarrayadapter(getactivity(), cacheddata.getinstance().gettripslist()); lv.setadapter(tripsarrayadapter); long endnano= system.nanotime(); system.out.println("time create: "+(endnano-startnano)); return view; }
is correct way?
i wouldn't rely on above code drawing not done within setadapter
method. use hierarchyviewer
, check how each view took draw , layout.
there great article on developer website on debugging ui , there another article romain guy treats ui performance.
Comments
Post a Comment