The application at startup connects to the server and takes data from it. This process occurs for some time and asynchronously.

During the download, instead of the content of the activation, there should be some screen saver in full screen, and when the activation is finished, it is filled with content.

Question: how laconic and quickly change the entire contents of the screen? Do not cause the same new activity. How did you do it?

  • one
    There is nothing wrong with using SplashActivity. You can still use progressDialog; if you load a list, use the swypeRefreshLayout component. - Android Android

2 answers 2

A typical solution to your question is to just trigger a new activation.

If it is required to provide a static image for the waiting time (without user interaction), then you can simply prepare the necessary markup and, before launching the request for data from the server, set it via setContentView() , after receiving the data using the same method, set the basic markup.
It is also necessary to foresee the processing of turns, so that in this case there was no substitution of markup and only the main markup was always active during the execution of the business logic.

For dynamic interaction (for example, something like the "Click to continue" button) this method is not suitable, due to the multitude of pitfalls and extreme implementation of crutality in practice - in this case a separate Splash Activity is done

    Maybe not really in the topic, in relation to your project ... The first thought that comes to mind:

    Add a simple html page to the project, let's say with a splash screen on js or video in main, activate as a block, + a script for checking data readiness on the server, and hide the contents of this block if successful.

    I will make a reservation, I made unpretentious applications that either pulled the site in the net view, or collected a non-native application using jquery mobile and html as a site within the project, so the above may not be applicable in your case.

    • 3
      This is definitely not a solution for "native" development for android. - pavlofff