Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show loading icon in the activity titlebar

How do you show a loading icon in the activity titlebar?

like image 954
Sander Versluys Avatar asked Dec 09 '10 15:12

Sander Versluys


1 Answers

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.your_layout);
}

Then... where ever you want:

// then, you can do this to show the icon
setProgressBarIndeterminateVisibility(true);
//or to hide it
setProgressBarIndeterminateVisibility(false);

Make sure to use requestWindowFeature before setContentView.

like image 196
Cristian Avatar answered Sep 21 '22 09:09

Cristian