Android デバイスの画面のリフレッシュ時間を測定する方法はありますか?
setText メソッドを呼び出した後、画面にテキストを描画するのにかかった時間を知りたいです。
onDraw
a のメソッドをオーバーライドして、TextView
実際にいつ再描画されるかを調べることができます。
public class MyTextView extends android.widget.TextView {
private long mUpdateTime;
public MyTextView(Context context) {
super(context);
}
public void mySetText(CharSequence text) {
mUpdateTime = System.currentTimeMillis();
super.setText(text);
}
@Override
public void onDraw(Canvas c) {
super.onDraw(c);
long refreshTime = System.currentTimeMillis() - mUpdateTime;
//Do something with refreshTime
}
}