I followed the guide in the following tutorial.
http://dan.clarke.name/2011/04/how-to-make-a-simple-android-game-with-cocos2d/
right on the first run i got the following error.
04-29 10:21:08.022: E/AndroidRuntime(12702): FATAL EXCEPTION: GLThread 10
04-29 10:21:08.022: E/AndroidRuntime(12702): java.lang.NullPointerException
04-29 10:21:08.022: E/AndroidRuntime(12702): at org.cocos2d.nodes.CCAtlasNode.updateBlendFunc(CCAtlasNode.java:168)
04-29 10:21:08.022: E/AndroidRuntime(12702): at org.cocos2d.nodes.CCAtlasNode.<init>(CCAtlasNode.java:77)
04-29 10:21:08.022: E/AndroidRuntime(12702): at org.cocos2d.nodes.CCLabelAtlas.<init>(CCLabelAtlas.java:40)
04-29 10:21:08.022: E/AndroidRuntime(12702): at org.cocos2d.nodes.CCLabelAtlas.label(CCLabelAtlas.java:35)
04-29 10:21:08.022: E/AndroidRuntime(12702): at org.cocos2d.nodes.CCDirector.setGLDefaultValues(CCDirector.java:593)
04-29 10:21:08.022: E/AndroidRuntime(12702): at org.cocos2d.nodes.CCDirector.onSurfaceCreated(CCDirector.java:636)
04-29 10:21:08.022: E/AndroidRuntime(12702): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1349)
04-29 10:21:08.022: E/AndroidRuntime(12702): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1119)
That library is no longer updated. It will be better to start using: http://www.cocos2d-x.org/. It uses C++, to work on android, use JNI (Native code). Code can be ported to any other platforms, like IOS.
Hope it will help!
Related
When displaying a Facebook share dialog using the following code, the Facebook crashes.
FacebookDialog.ShareDialogBuilder builder =
new FacebookDialog.ShareDialogBuilder(activity);
FacebookDialog shareDialog = builder.build();
return shareDialog.present();
This is the stack trace that is returned:
04-29 15:47:52.929 32647-32647/? E/ACRA﹕ ACRA caught a StackOverflowError exception for com.facebook.katana. Building report.
04-29 15:47:52.934 2214-2214/? E/display﹕ invalid gralloc handle (at 0x0)
04-29 15:47:52.944 32647-32647/? E/fb4a(:<default>):ACRA﹕ Handling exception for crash
java.lang.StackOverflowError
at android.os.Parcel.writeInt(Parcel.java:484)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:608)
at android.os.Bundle.writeToParcel(Bundle.java:1692)
at android.os.Parcel.writeBundle(Parcel.java:636)
at android.os.Parcel.writeValue(Parcel.java:1201)
...
04-29 15:47:54.609 32647-32647/? E/CatchMeIfYouCan﹕ java.lang.StackOverflowError
04-29 15:47:54.609 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Parcel.writeInt(Parcel.java:484)
04-29 15:47:54.609 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Parcel.writeArrayMapInternal(Parcel.java:608)
04-29 15:47:54.609 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Bundle.writeToParcel(Bundle.java:1692)
04-29 15:47:54.609 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Parcel.writeBundle(Parcel.java:636)
04-29 15:47:54.609 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Parcel.writeValue(Parcel.java:1201)
...
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Parcel.writeArrayMapInternal(Parcel.java:618)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Bundle.writeToParcel(Bundle.java:1692)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Parcel.writeBundle(Parcel.java:636)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.content.Intent.writeToParcel(Intent.java:7414)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.ActivityManagerProxy.finishActivity(ActivityManagerNative.java:2480)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.Activity.finish(Activity.java:4303)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.facebook.base.activity.FbFragmentActivity.finish(FbFragmentActivity.java:313)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.facebook.platform.common.activity.PlatformWrapperActivity.a(PlatformWrapperActivity.java:489)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.facebook.platform.common.activity.PlatformWrapperActivity.e(PlatformWrapperActivity.java:401)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.facebook.platform.common.activity.PlatformWrapperActivity.c(PlatformWrapperActivity.java:374)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.facebook.platform.common.activity.PlatformWrapperActivity.a(PlatformWrapperActivity.java:269)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.facebook.base.activity.FbFragmentActivity.onCreate(FbFragmentActivity.java:171)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.Activity.performCreate(Activity.java:5428)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2271)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.ActivityThread.access$800(ActivityThread.java:164)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Handler.dispatchMessage(Handler.java:102)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Looper.loop(Looper.java:157)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.ActivityThread.main(ActivityThread.java:5350)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at java.lang.reflect.Method.invokeNative(Native Method)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at java.lang.reflect.Method.invoke(Method.java:515)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at dalvik.system.NativeStart.main(Native Method)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ Process (<default>) is exiting...
It appears that FbFragmentActivity.finish is causing a stack overflow trying to create a parcel, but I can't determine what is causing that process to enter an infinite loop. So far this has only been replicable on Samsung devices.
Edit:
Removed debug code from code snippet.
this how i try to create a sqlite database on network hard disk (seagate wireless)
public DBControllerClient(Context applicationcontext) {
super(applicationcontext,"smb://172.25.0.1/Public-01/Documents/NouveauDB.db", null, 1);
Log.d(LOGCAT,"Created DBController");
}
Firt : can i do that to create db ?
When i try to see all data, i have this mistakes : file "smb://172.25.0.1/Public-01/Documents/NouveauDB.db" contains a path separator.
this is my logcat :
04-29 10:08:47.310: E/AndroidRuntime(4405): FATAL EXCEPTION: main
04-29 10:08:47.310: E/AndroidRuntime(4405): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.opencv.samples.facedetect/com.client.FicheClient1}: java.lang.IllegalArgumentException: File smb://172.25.0.1/Public-01/Documents/NouveauDB.db contains a path separator
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2194)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2244)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.os.Looper.loop(Looper.java:137)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ActivityThread.main(ActivityThread.java:5060)
04-29 10:08:47.310: E/AndroidRuntime(4405): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 10:08:47.310: E/AndroidRuntime(4405): at java.lang.reflect.Method.invoke(Method.java:511)
04-29 10:08:47.310: E/AndroidRuntime(4405): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-29 10:08:47.310: E/AndroidRuntime(4405): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-29 10:08:47.310: E/AndroidRuntime(4405): at dalvik.system.NativeStart.main(Native Method)
04-29 10:08:47.310: E/AndroidRuntime(4405): Caused by: java.lang.IllegalArgumentException: File smb://172.25.0.1/Public-01/Documents/NouveauDB.db contains a path separator
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ContextImpl.makeFilename(ContextImpl.java:1992)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ContextImpl.validateFilePath(ContextImpl.java:1976)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:866)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:229)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
04-29 10:08:47.310: E/AndroidRuntime(4405): at com.client.DBControllerClient.getAllClient(DBControllerClient.java:126)
04-29 10:08:47.310: E/AndroidRuntime(4405): at com.client.FicheClient1.onCreate(FicheClient1.java:370)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.Activity.performCreate(Activity.java:5146)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2156)
04-29 10:08:47.310: E/AndroidRuntime(4405): ... 11 more
How can i do to solve my problem please ?
thx for your lights
I'm trying to dynamically add a Fragment to my ViewPager using the common ways I found as a result of some searching, I tried two ways:
the First one is from the Activity that is the parent of the ViewPager :
Light_Center fragment = new Light_Center(); // the Fragment Activity
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.add(fragment, "num_" + i);
ft.commit(); // this is where i got the Exception
the second one is from the Fragment Activity itself (Light_Center.Class):
FragmentManager childFragMan = getChildFragmentManager();
FragmentTransaction childFragTrans = childFragMan.beginTransaction();
Light_Center fragB = new Light_Center();
childFragTrans.add(R.id.light_center_fragment, fragB);
childFragTrans.addToBackStack("B");
childFragTrans.commit(); // this is where i got the Exception
and the two ways gave me the same Exception at the commit() line:
04-29 12:46:04.099: E/AndroidRuntime(1307): FATAL EXCEPTION: main
04-29 12:46:04.099: E/AndroidRuntime(1307): java.lang.IllegalStateException: Activity has been destroyed
04-29 12:46:04.099: E/AndroidRuntime(1307): at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1365)
04-29 12:46:04.099: E/AndroidRuntime(1307): at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:595)
04-29 12:46:04.099: E/AndroidRuntime(1307): at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:574)
04-29 12:46:04.099: E/AndroidRuntime(1307): at com.automation.isolace.Lighting$11.onClick(Lighting.java:339)
04-29 12:46:04.099: E/AndroidRuntime(1307): at android.view.View.performClick(View.java:4084)
04-29 12:46:04.099: E/AndroidRuntime(1307): at android.view.View$PerformClick.run(View.java:16966)
04-29 12:46:04.099: E/AndroidRuntime(1307): at android.os.Handler.handleCallback(Handler.java:615)
04-29 12:46:04.099: E/AndroidRuntime(1307): at android.os.Handler.dispatchMessage(Handler.java:92)
04-29 12:46:04.099: E/AndroidRuntime(1307): at android.os.Looper.loop(Looper.java:137)
04-29 12:46:04.099: E/AndroidRuntime(1307): at android.app.ActivityThread.main(ActivityThread.java:4745)
04-29 12:46:04.099: E/AndroidRuntime(1307): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 12:46:04.099: E/AndroidRuntime(1307): at java.lang.reflect.Method.invoke(Method.java:511)
04-29 12:46:04.099: E/AndroidRuntime(1307): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
I found a lot of questions on StackOverFlow that represent the same Exception but neither with the way I'm using.
What is happening is you are beginning the getChildFragmentManager().beginTransaction() and before you are able to execute .commit() your activity or fragment is getting destroyed. I have a similar problem. You are going to need to check your state and make sure things are still around before committing. What else is happening in your app when this error occurs?
Friends,
onCreate() I am loading data from webservice using Async thread.
when thread is started it shows progress bar on screen and loads data.
A sudden problem I have faced is when I start that activity progress bar is shown I change orientation of my phone second thread starts &
Application crashes.(Inovation Target Exception something like that).
Here is the log cat any one guide me what is the solution to this problem?
Code is simple
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.searchbanks);
threadBank = new AsyncBanks();
threadBank.execute("","");
}
04-29 16:08:26.811: ERROR/WindowManager(430): Activity com.FindMe.SearchBanks has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#44f64f98 that was originally added here
04-29 16:08:26.811: ERROR/WindowManager(430): android.view.WindowLeaked: Activity com.FindMe.SearchBanks has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#44f64f98 that was originally added here
04-29 16:08:26.811: ERROR/WindowManager(430): at android.view.ViewRoot.<init>(ViewRoot.java:247)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.view.Window$LocalWindowManager.addView(Window.java:424)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.Dialog.show(Dialog.java:241)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.FindMe.SearchBanks$AsyncBanks.onPreExecute(SearchBanks.java:133)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.os.AsyncTask.execute(AsyncTask.java:391)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.FindMe.SearchBanks.LoadRecords(SearchBanks.java:115)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.FindMe.SearchBanks.onCreate(SearchBanks.java:76)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.os.Looper.loop(Looper.java:123)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:08:26.811: ERROR/WindowManager(430): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:08:26.811: ERROR/WindowManager(430): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-29 16:08:26.811: ERROR/WindowManager(430): at dalvik.system.NativeStart.main(Native Method)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): java.lang.IllegalArgumentException: View not attached to window manager
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:355)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:200)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.view.Window$LocalWindowManager.removeView(Window.java:432)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.Dialog.dismissDialog(Dialog.java:278)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.Dialog.access$000(Dialog.java:71)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.Dialog$1.run(Dialog.java:111)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.Dialog.dismiss(Dialog.java:268)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at com.FindMe.SearchBanks$AsyncBanks.onPostExecute(SearchBanks.java:197)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at com.FindMe.SearchBanks$AsyncBanks.onPostExecute(SearchBanks.java:1)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.AsyncTask.finish(AsyncTask.java:417)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.AsyncTask.access$300(AsyncTask.java:127)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.Looper.loop(Looper.java:123)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at dalvik.system.NativeStart.main(Native Method)
Even if you dismiss your dialog so that you can recreate it, there seems to be a race condition between the system destroying the dialog and the lifecycle methods where you would dismiss it. Very rarely I get a crash report about dismissing a non-existent dialog at configuration change time.
I suggest catching and ignoring the exception in Dialog.dismiss() just to handle the race condition. That's what I've done and it's cleared up my problem.
Steve # WhitneyApps
Finally i got answer myself.
How to deal with orientation change with a ProgressDialog showing?
And
How to handle Activity when Orientation changes?
I am developing a simple example for TabActivity...When i am trying to run...It shows the 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): could not get driver version for /dev/input/mouse0, Not a typewriter
04-29 16:13:33.001: ERROR/EventHub(60): could not get driver version for /dev/input/mice, Not a 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): at android.os.BinderProxy.transact(Native Method)
04-29 16:13:33.401: ERROR/System(60): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
04-29 16:13:33.401: ERROR/System(60): at android.os.ServiceManager.addService(ServiceManager.java:72)
04-29 16:13:33.401: ERROR/System(60): at 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): Could 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 to start activity ComponentInfo{com.android/com.android.tab_sample}: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.os.Looper.loop(Looper.java:123)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at dalvik.system.NativeStart.main(Native Method)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): Caused by: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.TabActivity.onContentChanged(TabActivity.java:105)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.Activity.setContentView(Activity.java:1647)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at com.android.tab_sample.onCreate(tab_sample.java:14)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at 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 to start activity ComponentInfo{com.android/com.android.tab_sample}: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'**
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.os.Looper.loop(Looper.java:123)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at dalvik.system.NativeStart.main(Native Method)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): Caused by: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.TabActivity.onContentChanged(TabActivity.java:105)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.Activity.setContentView(Activity.java:1647)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at com.android.tab_sample.onCreate(tab_sample.java:14)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): ... 11 more
and my 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 help me to solve this problem....
in xml, your tabhost id should be id="#android:id/tabhost" Check this: Android Tab Host
Some important logcat lines are:
16:29:46.777: ERROR/AndroidRuntime(738): Caused by: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost' 04-29 16:29:46.777:
It seems like it can't find your id, but that's weird since that should give a compiling error. Are you changing/creating the id's dynamically somehow?
If you're using some other activities from a library, make sure the layout files are different. E.g. avoid having double main.xml files.