0

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

textView.setText("hello");
Abhilasha
  • 929
  • 1
  • 17
  • 37
jas7
  • 2,893
  • 6
  • 23
  • 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,996
  • 17
  • 19
0

Use Android Traceview in eclipse

Vishwanath.M
  • 6,235
  • 11
  • 42
  • 56
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,747
  • 4
  • 32
  • 52