Closed yashrajgupta closed 3 years ago
Make sure you are calling the addDrawTask method in your implementation Even after calling the addDrawTask method, if invalidate() is not called on UI thread, then the onDraw() might not be invoked. Therefore, we can be sure of calling it on UI thread by implementing the following statement :
context.getUITaskDispatcher().asyncDispatch(this::invalidate);
This personally worked for me when i was trying to call the onDraw() method continuously for displaying an animation.
I am using invalidate() in my onDraw to get a loading view but it is not starting the onDraw call.
Link to stackoverflow
https://stackoverflow.com/questions/68586761/invalidate-in-ondraw-is-not-calling-ondraw
Additional information
Developer Platform: Windows DevEco Studio version: 2.1.0.303 SDK API version: 5 SDK version: 2.1.1.21 Device: Not Required Device OS version: Not Required