0

How do I calculate the time needed for TextView to render a line of text?

textView.setText("hello");
Abhilasha
  • 901
  • 1
  • 16
  • 37
jas7
  • 2,663
  • 6
  • 21
  • 36

3 Answers3

1

You can extend TextView class and override draw:

@Override
public void draw(Canvas canvas) {
    //log start time
    super.draw(canvas);
    //log end time
}
Maxim
  • 2,981
  • 15
  • 18
0

Use Android Traceview in eclipse

Vishwanath.M
  • 6,105
  • 10
  • 41
  • 55
0

An alternative to @Maxim is to just log before and after setText("hello");

Log.i(logTag, "start time");
textView.setText("hello");
Log.i(logTag, "end time");

This won't work if the view is only rendered after the call to setText though. Maybe someone can confirm or deny that in a comment.

Mike T
  • 4,697
  • 4
  • 30
  • 52