I tried to use ProgressBar in my Activity when I execute a short-time operation. And I realized that when I set ProgressBar visibility to true, It becomes visible only after the operation was executed.
progressBar.setVisibility(View.VISIBLE);
calculate();
Then I found the solution that I have to set ProgressBar visibility in another Thread. So my question is: why do I have to set it in another Thread?
For example, if I leave my ProgressBar with true visibility on creation (in onCreate()), it will progress and I can interact with UI in that moment. I concluded that they execute in one thread and It's okay. But It seems to me I'm wrong.