I have an http request and some UI change during that time and I want to show the activity indicator during that time . I want to show it in the title bar. I want to show progress indicator in the title in android like activity indicator in iphone?
From your activity code:
getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
...
// when you need to show progress:
setProgressBarIndeterminate([true|false]);
Yes, above two/three lines need to be used in following way.
1) Need to add this before calling setContentView() method.
getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
2) Need to add this after calling setContentView() method.
setProgressBarIndeterminateVisibility(true);
To stop the progress indicator
setProgressBarIndeterminateVisibility(false);
If we start showing progress from a parent activity and closing from a child activity,
ParentActivity parent = (ParentActivity)getParent();
parent.setProgressBarIndeterminateVisibility(false);
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