I am writing a code which requires to update a UI multiple times within a second to display an animation .But after calling invalidate the onDraw() method gets called after around 100ms and hence the number of times the screen is repainted is reduced to only 4 or 5 times a second.
I want to know as to what exactly causes the time difference between the invalidate() command and the calling of onDraw method.
Is there any way I can reduce the delay so that my animation can be smooth?? Thanks in advance.
It is a big code I'll just post the simple format for it:
public class CustomImageView extends ImageView {
private boolean doDoubleTap(MotionEvent e) {
<Loop>
tuneMatrix(matrix);//here i am changing the values for the matrix.(ie scaling and all)
invalidate();
System.out.println("CustomImageView.doDoubleTap():invalidate");
</LOOP>
}
onDraw(){
System.out.println("CustomImageView.onDraw():start");
//my code changes
}
}
Now the timedifference between logs "CustomImageView.doDoubleTap():invalidate" and "CustomImageView.onDraw():start" is ~100ms. I want to reduce that to a max of 30ms.