Reputation: 549
I am currently strugeling with the ProgressBar in the ActionBar. If I try
super.onCreate(savedInstanceState);
supportRequestWindowFeature(Window.FEATURE_PROGRESS|Window.FEATURE_INDETERMINATE_PROGRESS);
mViewPager = new ViewPager(this);
mViewPager.setId(R.id.pager);
setContentView(mViewPager);
This throws an
call requestWindowFeature before setContentView
If I put supportRequestWindowFeature right before the super.onCreate it throws a NullPointer-Exception. If I only use one Feature it either works on Android 2.3.3 or 4.4.2 (currently available devices) with laster configuration. What do I do wrong?
Upvotes: 0
Views: 1579
Reputation: 71
I think you miss the correct way to init it.Here is code from AndroidDeveloper
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Needs to be called before setting the content view
supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
// Now set the content view
setContentView(R.layout.activity_main);
...
// When ready, show the indeterminate progress bar
setSupportProgressBarIndeterminateVisibility(true);
}
Upvotes: 1