Event when user interface is displayed to user?

I would like my main form of loading to load a message. As soon as this is shown, I would like to start working with tabs that should load a rather heavy RSS feed. The problem is that I tried to override onStart and onWindowFocusChanged if hasFocus, but did not draw the view before starting another action. Does anyone know how to do this? All the splash screen examples use a timer, which is not what I want to do, I want it to stay while the data is loading and clearing when onPause starts.

+6
source share
1 answer

You cannot start another action while you are still showing another. You must change the flow of control.

Download the RSS feed from AsyncTask while you are still in your main action, showing a download message. When you finish downloading all the necessary data, save it somewhere , then launch the tab. This way, you do not need to load the data in the tab, but you can extract it from where you saved it.

0
source

Source: https://habr.com/ru/post/888882/


All Articles