I have problem with progress bar between two activities. When app loading form one activity to another activity I am getting blank screen for few seconds in my app due to the lazy loading images in the second activity. I want to display the progressbar in that blank screen. How can I do it?
Thanks and Regards,
Bhargav
Start your second activity and launch AsyncTask for lazy loading with ProgressDialog bounded in it.
See the example here or here, and check this question.
Related
I got a splash screen activity and a main activity with webview. It takes 4 to 5 seconds after loading of the main activity which is after the Splash screen, I wanted solution for start loading the main activity parallelly while in the splash screen
Thank you in advance 😊
Within splash activity you should create background service to finish time consuming jobs,
then transfer obtained data to main activity using bundle.Thus your main activity will load faster.
There are many ways to complete background tasks,please ref this doc.
Have loader on your MainActivity, once everything is loaded, just set loader's visibility to GONE.
No need to use SplashScreen in this case
I am trying to load a fragment which by fragment transation which has slide animation. The sliding effect starts with a delay of about 2-3 seconds after i press the button. I have reduced the heaviness of my UI as much as possible. Also, there are no background processes running? ow to start the sliding effect as soon as I press the button
Try prefetching data so that you don't have to do much processing when starting the fragment. If loading certain information takes some time, do it in the background and display default information like "Retrieving data..."
If you'd like to have a more detailed answer, please post code so we can help.
I want to show a splash screen between my first and second activity. Both the activities make use of AsyncTask. First being a simple login screen retrieving data for the whole app and second loads the activity specific data. Currently, both the activities have their own ProgressDialogs which is quite naive but they were developed individually and then I wasn’t planning to put them one after the other.
I tried to implement the splash screen only replace a loading process from one activity. But, in order to place a splash screen in between them do I have to transfer all the loading process to a single activity? Which activity should contain the code for the splash screen? I basically want to replace two ProgressDialogs by a single splash screen. What should I do?
I think the simplest way would just make a transitional activity that displays a splash screen, preloads the data for the next activity, then launches the next activity.
Activity A loads Activity B which shows the splash screen while simultaneously running the AsyncTask. Once the AsyncTask completes load Activity C.
I hope I understand your question correctly :-)
Can anyone put me on the right path so that i'm able to develop a Pre-loading page which is visible till the application loads in background.
I'd suggest you use an AsyncTask implementation for loading your application in a background thread.
In the AsyncTask's
onPreExecute method you display an
image (splash screen / loading
spinner / progress dialog...),
doInBackground method you load the
necessary data for your application
to start, and in the
onPostExecute method you remove
the preloader image, and display
your application which already has
all the necessary data.
I think you should implement a thread which will show an image related to your application.
After some time you call your first Activity.
I am looking for some guidance and hopefully someone can tell me the proper way to implement this scenario. In my app I am going to show a splash screen on startup and immediately start downloading some data from internet. When splash screen is finished, after about three seconds, the mapview should be shown. When the downloading of data is finished, after about one to ten seconds, the mapview should be updated with points of interest relating to the downloaded data. How do I best implement this in Android. Of course I first have an activity for the splash screen and another mapactivity for the mapview. But what do I use to download the data and when it is finished notify the mapactivity to update the mapview? Do I use an asynctask?
Best regards
P
SplashScreen does not need to be a separate Activity since it does not handle user events.
Just put splash screen and mapview inside one activity. Use FrameLayout to position splash screen on top of mapview.
Start loading data when Activity starts (onCreate). Use AsyncTask to do network communication in the background while correctly updating view when data arrives.
Create Handler and call postDelayed() to dismiss splash screen after some time.