3

I follow the steps in the customdialog example in the documentation, but I get this exception. Any ideas?

04-03 18:50:28.787: VERBOSE/Bru_Press_Tab(750): Exception in Tabsjava.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.brown/com.example.brown.Bru_Press_MostRecent}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
coder
  • 10,460
  • 17
  • 72
  • 125
Praveen
  • 90,477
  • 74
  • 177
  • 219

1 Answers1

10

Most likely, you are calling requestWindowFeature() after calling setContentView(). It may be you are not doing that directly, but that classes you inherit from are, because you are doing some other things slightly out of sequence.

So, find out where you are doing that and change the order such that you call requestWindowFeature() first.

For example, here is a sample project from one of my books that uses the progress-indicator-in-the-title-bar trick and therefore needs to call requestWindowFeature(). I had to do that in onCreate() before calling setContentView() on the activity.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • how do we customized ProgressDialog box having customized background and customized buttons (positive and cancel)? Please steer to example code I need it badly. – Sam Feb 26 '14 at 11:51