LumisD LumisD - 29 days ago 7
Android Question

picture which is shown while one activity starts after another

I want to show the same image on the screen non-stop while the 3 activities start one by one : LoadingActivity, MainActivity, and then DetailActivity, and all this time the user sees only one image.

Thus, the picture should hide starting multiple activities in a row. Typically, when the application starts, starting LoadingActivity, then MainActivity, then DetailActivity. Usually it ends at the MainActivity, and while the LoadingActivity is starting , the user sees the Welcom—É layout for a few seconds, and then the MainActivity interface. It's very rarely necessary to go to the DetailActivity, for example, when the browser link to the DetailActivity has already been chosen.
But when I get a push notification, I need to go to the DetailActivity immediately bypassing the LoadingActivity and MainActivity, I do not launch multiple services, do not take updates from the server, do not set the required variables, which means that when the user tries to do something from the DetailActivity, the functionality will be limited.
But what I'm trying to say is that I don't like that all 3 interfaces are shown when user presses the push notification, so I decided to ask if it's possible to have only one picture hanging during all these three activities loading?

Answer

To get a picture hanging in a row, all three activities, I duplicated to the MainActivity some key points from the LoadingActivity. Push starts MainActivity, if it is push, then I don't show a main layout, but an additional, with a picture. Next, I run websoket, login and query the server for updating data relating to this particular push. I receive data and load the DetailActivity, displaying the right information.

Additionally I made: - in onStop of MainActivity I switch to main layout, so that when user press the back of the DetailActivity, he sees a normal layout of the MainActivity. - If within 10 seconds do not get a response from the server, then just display DetailActivity without new information. This is not good, but better than to open the MainActivity user may not immediately find the desired option and opens DetailActivity.

Comments