android - My TabHost HAS a FrameLayout with that id -
this code:
tabhost = (fragmenttabhost) findviewbyid(r.id.tabhost); tabhost.setup(this, getsupportfragmentmanager(), r.id.tabcontent); tabhost.addtab(tabhost.newtabspec("tab1").setindicator("lengüeta 1"), tab1.class, null); tabhost.addtab(tabhost.newtabspec("tab2").setindicator("lengüeta 2"), tab2.class, null); tabhost.addtab(tabhost.newtabspec("tab3").setindicator("lengüeta 3"), tab3.class, null);
in xml:
<android.support.v4.app.fragmenttabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <tabwidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"/> <framelayout android:id="@+id/tabcontent" android:layout_width="match_parent" android:layout_height="0dp"/> </linearlayout> </android.support.v4.app.fragmenttabhost>
i getting exception:
08:07:22.353 1970-1970/com.infaplic.lpi e/androidruntime﹕ fatal exception: main process: com.infaplic.lpi, pid: 1970 java.lang.runtimeexception: unable start activity componentinfo{my.package/my.package.activities.swipeactivity}: java.lang.runtimeexception: tabhost must have framelayout id attribute 'android.r.id.tabcontent' @ android.app.activitythread.performlaunchactivity(activitythread.java:2263) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2313) @ android.app.activitythread.access$800(activitythread.java:144) @ android.app.activitythread$h.handlemessage(activitythread.java:1246) @ android.os.handler.dispatchmessage(handler.java:106) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5212) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:515) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:786) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:602) @ dalvik.system.nativestart.main(native method) caused by: java.lang.runtimeexception: tabhost must have framelayout id attribute 'android.r.id.tabcontent' @ android.widget.tabhost.setup(tabhost.java:163) @ android.support.v4.app.fragmenttabhost.setup(fragmenttabhost.java:197) @ com.infaplic.lpi.activities.swipeactivity.oncreate(swipeactivity.java:59) @ android.app.activity.performcreate(activity.java:5240) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1088) @ android.app.activitythread.performlaunchactivity(activitythread.java:2227)
@ android.app.activitythread.handlelaunchactivity(activitythread.java:2313) @ android.app.activitythread.access$800(activitythread.java:144) at android.app.activitythread$h.handlemessage(activitythread.java:1246) at android.os.handler.dispatchmessage(handler.java:106) at android.os.looper.loop(looper.java:136) at android.app.activitythread.main(activitythread.java:5212) at java.lang.reflect.method.invokenative(native method) at java.lang.reflect.method.invoke(method.java:515) at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:786) at com.android.internal.os.zygoteinit.main(zygoteinit.java:602) at dalvik.system.nativestart.main(native method)
i have tried changing id attribute "android.r.id.tabcontent". tried delete r class, , of course clean , rebuild. rid of exception in 2015...?
as stacktrace says, android:id
attribute has not @+id/tabcontent
, @android:id/tabcontent
Comments
Post a Comment