java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.FirstView/com.example
来源:互联网 发布:软件测试验收大纲 编辑:程序博客网 时间:2024/05/16 10:46
这个问题困扰了我一个晚上的时间
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.FirstView/com.example.FirstView.SeconsView}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
本来是找不到答案以为我一直以为问题是处在主activity里面但是最后仔细看了看以上这句话的时候,突然发现后半句AndroidRuntimeException: requestFeature() must be called before adding content里面有个requestFeature() 这个语句,我突然想起来我在secondview里面加入的那个使菜单栏消失的语句
requestWindowFeature(Window.FEATURE_NO_TITLE);
注释掉以后就没有这个问题了,具体原因是什么暂时不知道,估计随着学习的深入会明白的。下面是我的secondView的 代码。
package com.example.FirstView;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.Toast;
public class SeconsView extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.second_view);
//requestWindowFeature(Window.FEATURE_NO_TITLE);
Button button = (Button) findViewById(R.id.mybut1);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
int duration=300;
// TODO Auto-generated method stub
Toast.makeText(SeconsView.this, "You are my lover!", duration).show();
}
});
}
}
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.FirstView/com.example
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.w/com.example.w.MainA
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.xiaoshuo01/com.exampl
- 错误:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.tongzhi
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.bingbing.littlefarmer
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.irun/com.exampl
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.AndroidCaptureC
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.clm.activity/com.clm.activity
- java.lang.RuntimeException: Unable to start activity ComponentInfo{ com.xuqinjun.hello01/com.xuqinj
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wwj.toggle/com.wwj.toggle.Set
- java.lang.RuntimeException:Unable to start activity ComponentInfo{com.meizu.beautify/com.my.viewc.Ma
- Android问题1: Unable to start activity ComponentInfo{com.example.demo/com.example.demo
- Unable to start activity ComponentInfo{com.example.hellotest/com.example.hellotest.TypefaceActivity}
- Unable to start activity ComponentInfo{com.example.customview/com.example.customview.MainActivity}:
- Unable to start activity ComponentInfo{com.example.activity02/com.example.activity02.otheractivity}:
- Unable to start activity ComponentInfo{com.example.test/com.example.test.DividiDemoActivity
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.esri.arcgis.android.samples.h
- android中使用fragment时出现如下错误 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fra
- 通过伪AP进行DHCP+DNS劫持的钓鱼攻击
- ubuntu14.04从睡眠模式唤醒之后键盘僵死解决
- Android 4.4前后版本读取图库图片和拍照完美解决方案
- linux重定向详解
- [翻译][Trident] Storm Trident state 原理
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.FirstView/com.example
- tasklet 和 工作队列
- js实时显示上传的缩略图
- apache mina(一)-开源项目研究系列
- ffmpeg实现视频切割
- javascript鸭式辩型法实现接口
- 动态解析 嵌套JSON数据源
- 杨辉三角
- Android如何查看应用签名信息