I have tried on several occasions to use an animation to show loading during a long loop of operations.
However it seems as if the main thread is busy doing the actual operations and it never shows me the actual animation, or shows it at the end of the operations.
Any clues as to how i could , either start a new thread to handle the animation on a separate level, or something else i havent thought of...
Sometimes its just an actual transition i want to do, but it can also be something like initializing an entire new page with over 100 elements... It varies, i just want to know if there's a way to make sure the "loading animation" isn't bothered by the main thread running...
A transition shouldn't hold the main thread. You can use Sleep to implement it.
You are clear. However the layout will not be updated while the main thread is busy. The solution is:
1. Try to optimize the process.
2. Split it into smaller tasks and add Sleep in between to allow the UI to refresh.