must be called before adding content异常处理

关于以下异常的解决办法

 

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

今天根据教程写了一个例子,就是调用android中的android.hardware.Camera来完成拍照功能,但是遇到这么一个异常。

setContentView(R.layout.main);

  requestWindowFeature(Window.FEATURE_NO_TITLE); 

 

我是这么写的,结果抛异常了,解决方法如下:

  requestWindowFeature(Window.FEATURE_NO_TITLE); 

 setContentView(R.layout.main);

嗯,顺序换一下就好

猜你喜欢

转载自xp9802.iteye.com/blog/2095363
今日推荐