Invalidate inside a Timer

nicolasETIENNEnicolasETIENNE FRMember ✭✭✭


I have an activity with a button and a view.
When I detecte Touch Event "down" on the button, I create a Timer to call as long as the button is down a method.
this is working great only that the display is not refresh during the timer.

The action done by the timer is only changing a Point.X value and then doing an Invalidate() (I've tried PostInvalidate()).
but the GUI is not refreshed.

If I click on another button doing a "point.Y++" (with no timer), the position is well redrawn.

I know the timer calls the method to "up" the point (because when using other button without timer, I can see that the point
has been moved not only by One X but by many X prooving that the timer has done its job).

So, why is there no refresh during the "timer loop" ?

What should I do to make the UI well refreshed Invalidated() ?



  • FrankNielsenFrankNielsen DKMember
    edited April 2013

    Try surround it with:

    RunOnUiThread( () => [UI code here] );

  • nicolasETIENNEnicolasETIENNE FRMember ✭✭✭

    And the winner is Frank...

    Thanks a lot... It's working like a charm....

Sign In or Register to comment.