Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

App crashing due to " requestFeature() must be called before adding content" error

EDIT: switching from extending the deprecated ActionBarActivity to just Activity for all the involved Activities seems to have solved the issue....

see here: http://stackoverflow.com/questions/16939814/android-util-androidruntimeexception-requestfeature-must-be-called-before-add

So I noticed my options menus were a bit messed up and after trying to fix them I started getting a RuntimeException "Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content"

This happens in whatever activity and immediatly crashes the app upon any user interaction. The line being pointed to is

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

but im calling it before the setContentView()...

my onCreate looks like:

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
        setContentView(R.layout.activity_sign_up);

Any ideas whats going on here and how to fix?

This is the "Self Destructing Message App" course btw.