JakeWharton/ActionBarSherlock — Issue #309: requestFeature() must be called before adding content
Author: ericklee
Created: 2012-02-26 13:27:41+00:00
State: open

When using requestWindowFeature(), it works fine when the activity is first started.

Then I press the home key, so that the activity becomes stopped.
And after 1 minute I go back to the activity, following exception will occur.

AndroidRuntimeException: requestFeature() must be called before adding content
at com.actionbarsherlock.internal.ActionBarSherlockCompat.requestFeature(ActionBarSherlockCompat.java:618)

Sample codes:

public class Sample extends FragmentActivity {

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setSupportProgressBarIndeterminateVisibility(false);
setContentView(R.layout.main);
}

}