I am searching for some info on how to create loading animation in android. Is it possible to create this animation that i could call this animation in one thread and end in other ?
I seeking for this:
Animation animation = AnimationUtils. loadAnimation(getApplicationContext(), R. anim. myanimation);
Try below Code
ProgressDialog for showing:
ProgressDialog mDialog = new ProgressDialog(getApplicationContext());
mDialog.setMessage("Loading...");
mDialog.setCancelable(false);
mDialog.show();
After cancel ProgressDialog below code:
mdialog.dismiss();
This is basically done with an AsyncTask and a ProgressDialog (Using spinner style) that is started and dismissed by the AsyncTask.
You can not start/end ProgressDialog from any thread other that UI thread. In it's simplest for you would want to use AsyncTask methods onPreExecute onPostExecute. But I would be careful with that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With