android - Error in Running an aplication with tabActivity -


i developing simple example tabactivity...when trying run...it shows following exceptions.... log cat view....

04-29 16:13:04.870: error/zygote(33): setreuid() failed. errno: 2 04-29 16:13:17.520: error/zygote(33): setreuid() failed. errno: 17 04-29 16:13:20.940: error/batteryservice(60): usbonlinepath not found 04-29 16:13:20.940: error/batteryservice(60): batteryvoltagepath not found 04-29 16:13:20.940: error/batteryservice(60): batterytemperaturepath not found 04-29 16:13:20.980: error/surfaceflinger(60): couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake 04-29 16:13:33.001: error/eventhub(60): not driver version /dev/input/mouse0, not typewriter 04-29 16:13:33.001: error/eventhub(60): not driver version /dev/input/mice, not typewriter 04-29 16:13:33.401: error/system(60): failure starting core service 04-29 16:13:33.401: error/system(60): java.lang.securityexception 04-29 16:13:33.401: error/system(60):     @ android.os.binderproxy.transact(native method) 04-29 16:13:33.401: error/system(60):     @ android.os.servicemanagerproxy.addservice(servicemanagernative.java:146) 04-29 16:13:33.401: error/system(60):     @ android.os.servicemanager.addservice(servicemanager.java:72) 04-29 16:13:33.401: error/system(60):     @ com.android.server.serverthread.run(systemserver.java:184) 04-29 16:13:35.430: error/soundpool(60): error loading /system/media/audio/ui/effect_tick.ogg 04-29 16:13:35.450: error/soundpool(60): error loading /system/media/audio/ui/keypressstandard.ogg 04-29 16:13:35.470: error/soundpool(60): error loading /system/media/audio/ui/keypressspacebar.ogg 04-29 16:13:35.480: error/soundpool(60): error loading /system/media/audio/ui/keypressdelete.ogg 04-29 16:13:35.500: error/soundpool(60): error loading /system/media/audio/ui/keypressreturn.ogg 04-29 16:13:39.790: error/throttleservice(60): not open gps configuration file /etc/gps.conf 04-29 16:13:42.600: error/logwrapper(153): executing /system/bin/tc failed: no such file or directory 04-29 16:13:42.691: error/logwrapper(154): executing /system/bin/tc failed: no such file or directory 04-29 16:13:42.800: error/logwrapper(155): executing /system/bin/tc failed: no such file or directory 04-29 16:14:06.081: error/hierarchicalstatemachine(60): tethermaster - unhandledmessage: msg.what=3 04-29 16:14:50.237: error/androidruntime(301): fatal exception: main 04-29 16:14:50.237: error/androidruntime(301): java.lang.runtimeexception: unable start activity componentinfo{com.android/com.android.tab_sample}: java.lang.runtimeexception: content must have tabhost id attribute 'android.r.id.tabhost' 04-29 16:14:50.237: error/androidruntime(301):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2663) 04-29 16:14:50.237: error/androidruntime(301):     @ android.app.activitythread.handlelaunchactivity(activitythread.java:2679) 04-29 16:14:50.237: error/androidruntime(301):     @ android.app.activitythread.access$2300(activitythread.java:125) 04-29 16:14:50.237: error/androidruntime(301):     @ android.app.activitythread$h.handlemessage(activitythread.java:2033) 04-29 16:14:50.237: error/androidruntime(301):     @ android.os.handler.dispatchmessage(handler.java:99) 04-29 16:14:50.237: error/androidruntime(301):     @ android.os.looper.loop(looper.java:123) 04-29 16:14:50.237: error/androidruntime(301):     @ android.app.activitythread.main(activitythread.java:4627) 04-29 16:14:50.237: error/androidruntime(301):     @ java.lang.reflect.method.invokenative(native method) 04-29 16:14:50.237: error/androidruntime(301):     @ java.lang.reflect.method.invoke(method.java:521) 04-29 16:14:50.237: error/androidruntime(301):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868) 04-29 16:14:50.237: error/androidruntime(301):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:626) 04-29 16:14:50.237: error/androidruntime(301):     @ dalvik.system.nativestart.main(native method) 04-29 16:14:50.237: error/androidruntime(301): caused by: java.lang.runtimeexception: content must have tabhost id attribute 'android.r.id.tabhost' 04-29 16:14:50.237: error/androidruntime(301):     @ android.app.tabactivity.oncontentchanged(tabactivity.java:105) 04-29 16:14:50.237: error/androidruntime(301):     @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:201) 04-29 16:14:50.237: error/androidruntime(301):     @ android.app.activity.setcontentview(activity.java:1647) 04-29 16:14:50.237: error/androidruntime(301):     @ com.android.tab_sample.oncreate(tab_sample.java:14) 04-29 16:14:50.237: error/androidruntime(301):     @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 04-29 16:14:50.237: error/androidruntime(301):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2627) 04-29 16:14:50.237: error/androidruntime(301):     ... 11 more 04-29 16:29:46.777: error/androidruntime(738): fatal exception: main 04-29 16:29:46.777: error/androidruntime(738): **java.lang.runtimeexception: unable start activity componentinfo{com.android/com.android.tab_sample}: java.lang.runtimeexception: content must have tabhost id attribute 'android.r.id.tabhost'** 04-29 16:29:46.777: error/androidruntime(738):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2663) 04-29 16:29:46.777: error/androidruntime(738):     @ android.app.activitythread.handlelaunchactivity(activitythread.java:2679) 04-29 16:29:46.777: error/androidruntime(738):     @ android.app.activitythread.access$2300(activitythread.java:125) 04-29 16:29:46.777: error/androidruntime(738):     @ android.app.activitythread$h.handlemessage(activitythread.java:2033) 04-29 16:29:46.777: error/androidruntime(738):     @ android.os.handler.dispatchmessage(handler.java:99) 04-29 16:29:46.777: error/androidruntime(738):     @ android.os.looper.loop(looper.java:123) 04-29 16:29:46.777: error/androidruntime(738):     @ android.app.activitythread.main(activitythread.java:4627) 04-29 16:29:46.777: error/androidruntime(738):     @ java.lang.reflect.method.invokenative(native method) 04-29 16:29:46.777: error/androidruntime(738):     @ java.lang.reflect.method.invoke(method.java:521) 04-29 16:29:46.777: error/androidruntime(738):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868) 04-29 16:29:46.777: error/androidruntime(738):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:626) 04-29 16:29:46.777: error/androidruntime(738):     @ dalvik.system.nativestart.main(native method) 04-29 16:29:46.777: error/androidruntime(738): caused by: java.lang.runtimeexception: content must have tabhost id attribute 'android.r.id.tabhost' 04-29 16:29:46.777: error/androidruntime(738):     @ android.app.tabactivity.oncontentchanged(tabactivity.java:105) 04-29 16:29:46.777: error/androidruntime(738):     @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:201) 04-29 16:29:46.777: error/androidruntime(738):     @ android.app.activity.setcontentview(activity.java:1647) 04-29 16:29:46.777: error/androidruntime(738):     @ com.android.tab_sample.oncreate(tab_sample.java:14) 04-29 16:29:46.777: error/androidruntime(738):     @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 04-29 16:29:46.777: error/androidruntime(738):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2627) 04-29 16:29:46.777: error/androidruntime(738):     ... 11 more 

and code is....

 package com.android;  import android.app.tabactivity; import android.content.intent; import android.content.res.resources; import android.os.bundle; import android.widget.tabhost;  public class tab_sample extends tabactivity {     @override     public void oncreate(bundle savedinstancestate)     {         super.oncreate(savedinstancestate);         setcontentview(r.layout.tab_sample);         tabhost tab=(tabhost)findviewbyid(r.id.tabhost);         tab.setup();         resources res=getresources();          //tab=gettabhost();         intent int1=new intent(this,tab1.class);         intent int2=new intent(this,tab2.class);         tab.addtab(tab.newtabspec("tab1").setindicator("songs",res.getdrawable(r.drawable.tab1)).setcontent(int1));         tab.addtab(tab.newtabspec("tab2").setindicator("movie",res.getdrawable(r.drawable.tab2)).setcontent(int2));         //tab.addtab(tab.newtabspec("tab3"))         tab.setcurrenttab(0);     }  } 

please me solve problem....

in xml, tabhost id should id="@android:id/tabhost" check this: android tab host


Comments