标签:android style java c tar color
05-14 22:16:42.808: E/AndroidRuntime(22906): FATAL EXCEPTION: main
05-14
22:16:42.808: E/AndroidRuntime(22906): java.lang.RuntimeException: Unable to
start activity
ComponentInfo{com.example.sensor_125/com.example.sensor_125.MainActivity}:
android.util.AndroidRuntimeException: requestFeature() must be called before
adding content
05-14 22:16:42.808: E/AndroidRuntime(22906): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2077)
05-14
22:16:42.808: E/AndroidRuntime(22906): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
05-14
22:16:42.808: E/AndroidRuntime(22906): at
android.app.ActivityThread.access$600(ActivityThread.java:134)
05-14
22:16:42.808: E/AndroidRuntime(22906): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
05-14
22:16:42.808: E/AndroidRuntime(22906): at
android.os.Handler.dispatchMessage(Handler.java:99)
05-14 22:16:42.808:
E/AndroidRuntime(22906): at android.os.Looper.loop(Looper.java:154)
05-14
22:16:42.808: E/AndroidRuntime(22906): at
android.app.ActivityThread.main(ActivityThread.java:4624)
05-14 22:16:42.808:
E/AndroidRuntime(22906): at java.lang.reflect.Method.invokeNative(Native
Method)
05-14 22:16:42.808: E/AndroidRuntime(22906): at
java.lang.reflect.Method.invoke(Method.java:511)
05-14 22:16:42.808:
E/AndroidRuntime(22906): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
05-14
22:16:42.808: E/AndroidRuntime(22906): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
05-14
22:16:42.808: E/AndroidRuntime(22906): at dalvik.system.NativeStart.main(Native
Method)
05-14 22:16:42.808:
E/AndroidRuntime(22906): Caused by: android.util.AndroidRuntimeException:
requestFeature() must be called before adding content
05-14
22:16:42.808: E/AndroidRuntime(22906): at
com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:213)
05-14
22:16:42.808: E/AndroidRuntime(22906): at
android.app.Activity.requestWindowFeature(Activity.java:3097)
05-14
22:16:42.808: E/AndroidRuntime(22906): at
com.example.sensor_125.MainActivity.onCreate(MainActivity.java:22)
05-14
22:16:42.808: E/AndroidRuntime(22906): at
android.app.Activity.performCreate(Activity.java:4479)
05-14 22:16:42.808:
E/AndroidRuntime(22906): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
05-14
22:16:42.808: E/AndroidRuntime(22906): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
05-14
22:16:42.808: E/AndroidRuntime(22906): ... 11 more
05-14 22:16:42.813:
I/Process(22906): Sending signal. PID: 22906 SIG: 9
解决方法:
把this.setContentView比this.requestWindowFeature(Window.FEATURE_NO_TITLE)方法调用更早,所以报错 了。
只需要保证setContentView方法在requestWindowFeature方法之后执行就可以了。
requestFeature() must be called before adding content错误,布布扣,bubuko.com
requestFeature() must be called before adding content错误
标签:android style java c tar color
原文地址:http://www.cnblogs.com/xiaofengkang/p/3728825.html