Hello,
I'm trying to move a ball in the screen.
A piece of my code:
For a=1 To 500 step 1
' doevents?
canvas.DrawCircle(a-1,100,10,Colors.Black,True,1)
canvas.DrawCircle(a,100,10,Colors.White,True,1)
activity.Invalidate
Next
The thing is that if 'doevents' is not introduced into the For/next cycles, the circle is only visible at the end of the loop, when a=500. It takes only 1 second!
Otherwise, if 'doevents' is introduced, the process gets too slow, I mean, the circle is able to be watched from 1 to 500, but it takes much more time to cross the screen... around 15 seconds?..
I know that a posible solution is to increase the step, but would like if it's possible to accelerate/optimize this code. Is doevent neccesary? and what about activity.Invalidate?
Thanks a lot and happy new year!!:sign0060:
I'm trying to move a ball in the screen.
A piece of my code:
For a=1 To 500 step 1
' doevents?
canvas.DrawCircle(a-1,100,10,Colors.Black,True,1)
canvas.DrawCircle(a,100,10,Colors.White,True,1)
activity.Invalidate
Next
The thing is that if 'doevents' is not introduced into the For/next cycles, the circle is only visible at the end of the loop, when a=500. It takes only 1 second!
Otherwise, if 'doevents' is introduced, the process gets too slow, I mean, the circle is able to be watched from 1 to 500, but it takes much more time to cross the screen... around 15 seconds?..
I know that a posible solution is to increase the step, but would like if it's possible to accelerate/optimize this code. Is doevent neccesary? and what about activity.Invalidate?
Thanks a lot and happy new year!!:sign0060: