It looks like the MySurfaceView instance is created during the XML inflation of your activity. It is indeed a bit puzzling :) What does the body of the 'public void run()' method contain?
On Mar 24, 1:25 pm, Floof <floofy.lagayovi...@gmail.com> wrote: > Hi list, > > I'm having hard times getting my GL thread (from GLSurfaceView) to > trigger some code execution within the UI thread (from Activity). I > tried it in every possible way (well not every, I missed at least the > good one) none worked. > > My idea was to get something called from the UI thread (to update some > widgets) when the surface is effectively created. So I added to my > onSurfaceCreated method the following call: > > mActivity.runOnUiThread(mUpdater); > > mUpdater is a member of my GLSurfaceView sub-class. It is declared as > following: > > private Runnable mUpdater = new Runnable() { void run () { ... } }; > > This compiles, but when my GLSurfaceView sub-class is constructed a > NoClassDefFound exception is thrown, telling me that the class > com.my.package.MyGLSurfaceView$1 is not found. > > Here's the log: > > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): Uncaught handler: > thread main exiting due to uncaught exception > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): > java.lang.RuntimeException: Unable to start activity > ComponentInfo{com.my.package.MyApplication/ > com.my.package.MyApplication.MyApplication}: > android.view.InflateException: Binary XML file line #36: Error > inflating class com.my.package.MySurfaceView > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > 2468) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: > 2484) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.app.ActivityThread.access$2200(ActivityThread.java:119) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1835) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.os.Handler.dispatchMessage(Handler.java:99) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.os.Looper.loop(Looper.java:123) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.app.ActivityThread.main(ActivityThread.java:4325) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > java.lang.reflect.Method.invokeNative(Native Method) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > java.lang.reflect.Method.invoke(Method.java:521) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > com.android.internal.os.ZygoteInit > $MethodAndArgsCaller.run(ZygoteInit.java:860) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > dalvik.system.NativeStart.main(Native Method) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): Caused by: > android.view.InflateException: Binary XML file line #36: Error > inflating class com.my.package.MySurfaceView > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.view.LayoutInflater.createView(LayoutInflater.java:513) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.view.LayoutInflater.rInflate(LayoutInflater.java:618) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.view.LayoutInflater.rInflate(LayoutInflater.java:621) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.view.LayoutInflater.inflate(LayoutInflater.java:407) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.view.LayoutInflater.inflate(LayoutInflater.java:320) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.view.LayoutInflater.inflate(LayoutInflater.java:276) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java: > 198) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.app.Activity.setContentView(Activity.java:1622) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > com.my.package.MyApplication.MyApplication.onCreate(MyApplication.java: > 57) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: > 1047) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > 2431) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): ... 11 more > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): Caused by: > java.lang.reflect.InvocationTargetException > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > com.my.package.MySurfaceView.<init>(MySurfaceView.java:297) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > java.lang.reflect.Constructor.constructNative(Native Method) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > java.lang.reflect.Constructor.newInstance(Constructor.java:446) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): at > android.view.LayoutInflater.createView(LayoutInflater.java:500) > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): ... 22 more > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): Caused by: > java.lang.NoClassDefFoundError: com.my.package.MySurfaceView$1 > 02-12 18:05:21.407: ERROR/AndroidRuntime(1580): ... 26 more > > The line 297 in MySurfaceView.java is: > > private Runnable mUpdater = new Runable () { public void run () > { [...] } }; > > What have I missed ? > > Thanks for your help. > Floof. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.