Unable to start activity ComponentInfo: Resource ID is not valid
2013-10-26 22:14
597 查看
今天写代码时出现了无法启动Activity的情况,
先报的Resource ID is not valid的错误,原因是我在setcontentview(R.layout.xxx)是写成了setcontenview(R.id.xxx).刚好,这个布局文件我给了一个同名的ID。
home_content_frame.xml文件
"1.0" encoding="utf-8"?>
“http://schemas.android.com/apk/res/android”
我想在代码中使用fragment来代替这个布局
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.home_content_frame,mContent)
.commit();
先报的Resource ID is not valid的错误,原因是我在setcontentview(R.layout.xxx)是写成了setcontenview(R.id.xxx).刚好,这个布局文件我给了一个同名的ID。
home_content_frame.xml文件
"1.0" encoding="utf-8"?>
“http://schemas.android.com/apk/res/android”
android:id=<span class="str">"@+id/home_content_frame"</span> android:layout_width=<span class="str">"match_parent"</span> android:layout_height=<span class="str">"match_parent"</span> >
我想在代码中使用fragment来代替这个布局
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.home_content_frame,mContent)
.commit();
相关文章推荐
- Unable to start activity ComponentInfo{…}: android.content.res.Resources$NotFoundException: Resource
- Activity class {package/class} does not exist及Unable to start activity ComponentInfo 解决方法
- Activity class {package/class} does not exist及Unable to start activity ComponentInfo 解决方法
- Activity class {package/class} does not exist及Unable to start activity ComponentInfo 解决方法
- Unable to start activity ComponentInfo 解决方法
- Unable to start activity ComponentInfo{com.example.test/com.example.test.DividiDemoActivity
- Unable to instantiate activity ComponentInfo或java.lang.ClassNotFoundException: com.ibright.herolegen
- 错误ava.lang.RuntimeException: Unable to start activity ComponentInfo{*}java.lang.NullPointerException
- 记录错误:java.lang.RuntimeException: Unable to start activity ComponentInfo
- Android开发中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.NullPoi
- Unable to add window -- token null is not valid; is your activity running?错误及其修改方法
- Android开发中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.NullPoi
- 有关Unable to start activity ComponentInfo的一点BUG
- Unable to start activity ComponentInfo
- Unable to add window — token android.os.BinderProxy is not valid; is your activity running?
- Unable to start activity ComponentInfo XXX java.lang.IllegalArgumentException: Found empty contents
- Android中调用startActivity结果导致:java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}
- Unable to start activity ComponentInfo,请教如何解决?
- android报错java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}
- popupwindow使用之异常-Unable to add window -- token null is not valid; is your activity running?