Thursday, 5 February 2015

Android - RequestFeature Error

16:32:00 Posted by Kumanan
android.util.AndroidRuntimeException: requestFeature() must be called before adding content

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.mainmenu);


You should call window request before calling super.onCreate(), which is shown below,

@Override
public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mainmenu);
}