RequestNeature问题...在onNewIntent()中

时间:2015-08-07 12:05:40

标签: android

我尝试在setContent方法之前和之后添加,但面对问题仍然是“android.util.AndroidRuntimeException:requestFeature()必须在添加内容之前调用 “

 public void onNewIntent(Intent intent){
        final boolean customTitleSupported =
                requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        super.onNewIntent(intent);

        session = new SessionManagement(getApplicationContext());
        if(customTitleSupported){
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.item);
        }
        setContentView(R.layout.itemlist);
        setIntent(intent);

1 个答案:

答案 0 :(得分:1)

在致电requestWindowFeature(Window.FEATURE_CUSTOM_TITLE)之前,您应致电setContentView()super.onCreate()onCreate方法 Activity之前的好地方。