satyrFrost
satyrFrost

Reputation: 413

Android loading icon in title bar across multiple activities

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

Answers (1)

Paresh Mayani
Paresh Mayani

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

Related Questions