Android boot animation

I am looking for some information on how to create animation loading in android. Is it possible to create this animation, which I could call this animation in one thread and end in another?

I am looking for this:

enter image description here

+7
source share
3 answers

Try entering the code

ProgressDialog to show:

ProgressDialog mDialog = new ProgressDialog(getApplicationContext()); mDialog.setMessage("Loading..."); mDialog.setCancelable(false); mDialog.show(); 

After canceling the ProgressDialog below code:

  mdialog.dismiss(); 
+18
source

This is mainly done with AsyncTask and the ProgressDialog (using the spinner style), which AsyncTask starts and rejects.

+2
source

You cannot start / end ProgressDialog from any thread of another UI thread. In this simplest for you, it would be advisable to use the AsyncTask onPreExecute onPostExecute methods. But I would be careful with that.

  • You do not want to lose the link to the dialog from the async task (the user changes orientation or rotates the screen). So you want to save the WeakReference in the dialog box
  • If you are seriously busy downloading, I would use the service for it and listen to the callbacks of the service (for example, broadcasts) to control the dialog. It will also allow you to share the life cycle of an activity with background work.
+2
source

All Articles