首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >RequestFeature Issue ...in onNewIntent()

RequestFeature Issue ...in onNewIntent()
EN

Stack Overflow用户
提问于 2015-08-07 20:05:40
回答 1查看 32关注 0票数 0

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

代码语言:javascript
复制
 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);
EN

回答 1

Stack Overflow用户

发布于 2015-08-07 20:09:16

在调用setContentView()之前,应该先调用requestWindowFeature(Window.FEATURE_CUSTOM_TITLE)。一个不错的位置应该是在Activity中的onCreate方法中的super.onCreate()之前。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31877332

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档