Reputation: 413
I am using the code from this post to put a loading icon in the title bar of my Android App:
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.your_layout);
}
The code:
activity.setProgressBarIndeterminateVisibility(true);
is called in an AsyncTask. If the user navigates to a new activity, the icon is not longer present in the title bar since the icon was set for the first activity only.
Is there a way to have the icon show on all activities? Thanks in advance.
Upvotes: 1
Views: 466
Reputation: 128428
You can create super activity (i.e. Base Activity), include the below line in this super activity:
activity.setProgressBarIndeterminateVisibility(true);
And extends this activity to all the child activities.
Upvotes: 1