Reputation: 560
I need to get some objective measures that screen renders faster. Tell me, please, how to measure the time of calculating the size of layout views and their rendering.
I tried to use hierarchyviewer, but it doesn't work properly in my case. It shows zeros for most of views.
Upvotes: 0
Views: 500
Reputation: 5322
I didn't try it before, but I think you can extend your Layout
parent and override onMeasure()
like this:
@override onMeasure (int widthMeasureSpec, int heightMeasureSpec) {
float start=(float) System.currentTimeMillis();
super.onMeasure (widthMeasureSpec, heightMeasureSpec);
Log.i("ElapsedTime",String.valueOf(((float)System.currentTimeMillis())-start));
}
Then use this custom Layout
as the root for your layout. You can do this for each View
if you want to calculate them separately.
Upvotes: 1