android 应用requestFeature() must be called before adding content报错

文章详细介绍了在Android应用开发中遇到的'计算器'已停止运行的BUG,通过检查清单文件发现可能与冲突有关,并提供了解决方案。包括查看并调整清单文件中的设置,确保requestWindowFeature在setContentView之前调用。

 

现象描述

   测试提供了一个  很抱歉,"计算器"已停止运行的BUG。

log

      

     Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content

查看代码:

     

百度为  requestWindowFeature 必须在 setContentView之前,如此设置之后,依然有BUG。


解决

查看清单文件

<activity android:name="Calculator"
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                  android:screenOrientation="portrait"
                  android:windowSoftInputMode="stateAlwaysHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.APP_CALCULATOR" />
            </intent-filter>
        </activity>


可能与


冲突了,测试并未重现 "计算器"已停止运行的BUG。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值