现象描述
测试提供了一个 很抱歉,"计算器"已停止运行的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。
文章详细介绍了在Android应用开发中遇到的'计算器'已停止运行的BUG,通过检查清单文件发现可能与冲突有关,并提供了解决方案。包括查看并调整清单文件中的设置,确保requestWindowFeature在setContentView之前调用。

2207

被折叠的 条评论
为什么被折叠?



