Hi, Thanks for your help guys, I found what was causing the problem.
The inflater, even if classes are instanciated indirectly, needs a *.class file for each class. Meaning that you can't use class nesting or anonymous classes within those that will be inflated. I moved the Runnable implementation into it's own java file, named it, and this did the trick. I can now trigger population of a spinner from native data on the GL thread, and make it run on the UI thread ! Nice ! Me happy, Floof On Wed, Mar 24, 2010 at 11:12 PM, Bob Kerns <r...@acm.org> wrote: > (I presume the 'Runable' instead of 'Runnable' was just a typo...) > > NoClassDefFoundError doesn't mean what you think it means from the > name. > > It means that an error happened while the class was being loaded. And > for reasons that I cannot fathom, when Java added exception chaining, > they did not make THIS exception contain the original cause, so the > stack traces are ALWAYS mysterious. > > The best way to debug these is to actually debug them with the > debugger. Set exception breakpoints for Exception and Error. You'll > probably have to skip a bunch of harmless internal exceptions, but the > one before the NoClassDefFoundError is thrown should be the one you > want -- hopefully. > > Often it's because some class that's referenced in the code in > question won't load either -- and that's often because a static > initializer got an error. > > On Mar 24, 10:25 am, 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.jav > a: > > 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<android-developers%2bunsubscr...@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. > -- 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.