U need to use publish progress method
On Oct 18, 2013 9:27 PM, "Bradley O'Hearne" <[email protected]>
wrote:
> I have an indeterminate ProgressBar in an XML layout for a fragment. When
> I display this fragment the first time, the ProgressBar visibility is set
> to VISIBLE, and the activity circle spins until a loading operation is
> complete, at which time the ProgressBar visibility is set to INVISIBLE, and
> it disappears. All good so far.
>
> However, when conditions occur that causing the loading operation to
> happen again, the ProgressBar visibility is set to VISIBLE, but it does not
> animate (spin), it stays static. I can reinitiate that loading operation as
> many times as I want, and reset the ProgressBar visibility ad naseum, but
> it never spins again.
>
> First, the code is being invoked already on the UI thread, so it should
> work (it is actually downstream from the onReceive callback of a
> BroadcastReceiver, which at least with the references I've been able to dig
> up, is supposed to happen on the UI thread). However, just to be safe, I
> tried two other means of putting the changing of ProgressBar visibility on
> the UI thread, via:
>
> 1. Explicitly running on the UI thread:
>
> getActivity().runOnUiThread(new Runnable()
> {
> @Override
> public void run()
> {
> progressBar.setVisibility(View.VISIBLE);
> }
> });
>
> 2. Using an AsyncTask, where onPostExecute() is guaranteed to be on the UI
> thread.:
>
> public static class ProgressBarTask extends AsyncTask<Void, Void,
> Bitmap>
> {
> private ImageLoader loader;
>
> @Override
> protected Bitmap doInBackground(Void... params)
> {
> return true
> }
>
> @Override
> protected void onPostExecute(Bitmap result)
> {
>
> ImportantWrappingClass.this.progressBar.setVisibility(View.VISIBLE);
> }
> }
>
> In addition to this, I also tried resetting the ProgressBar's progress to
> 0 (even though it was indeterminate). None of the above had any effect, the
> ProgressBar still doesn't spin the second (or third, or n time it is
> displayed).
>
> So my question -- how can I get an indeterminate ProgressBar to spin when
> hidden/displayed again after the first time?
>
> Your answers are appreciated.
>
> Thanks,
>
> Brad
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.