I have the following scenario: in activity A, when a user clicks a button, the app sends a request to the server to retrieve some information, then this information is placed into an intent to start activity B.
In activity B, in onCreate
method, I do setContentView(R.layout.activity_b)
(this layout is quite complex, so even inflating it from XML takes a while), then do a bunch of initialisation. Finally, in onStart
I do some final preparation/arrangements of the components.
In activity A, when the user presses a button, I start an AsyncTask
, which gets the info from the server and starts activity B, passing the required info into intent. When I call 'startActivity', the window of activity B slides into position straight away, however it may take a few seconds to complete the initialisation. During these seconds, I see a black screen. Then, finally, the onStart
is executed and everything goes on.
What I would like to do is to complete all this initialisation off-screen, before activity B slides into view, so that when it "arrives", all the layout is already present. Any ideas how to achieve this?