You are calling findViewById(), and it probably returns null. The
second Gallery demo in the ApiDemos shows you can use other Views than
ImageView. Instead of findViewById(), you want to use ViewInflate.

On Sat, Apr 12, 2008 at 3:52 AM, hal <[EMAIL PROTECTED]> wrote:
>
>  Copied the wrong error messages in the last message. Here are the
>  correct ones below. It seems to me that it crashes when it tries to
>  initialize the new View in the Gallery, but I can't really determine
>  why it does so besides the fact that it's null pointering.
>
>  ERROR/AndroidRuntime(1451): Uncaught handler: thread Main exiting due
>  to uncaught exception
>  ERROR/AndroidRuntime(1451): java.lang.NullPointerException
>  ERROR/AndroidRuntime(1451):     at
>  android.widget.Gallery.setUpChild(Gallery.java:585)
>  ERROR/AndroidRuntime(1451):     at
>  android.widget.Gallery.makeAndAddView(Gallery.java:484)
>  ERROR/AndroidRuntime(1451):     at
>  android.widget.Gallery.layout(Gallery.java:293)
>  ERROR/AndroidRuntime(1451):     at
>  android.widget.Gallery.onLayout(Gallery.java:205)
>  ERROR/AndroidRuntime(1451):     at android.view.View.layout(View.java:
>  4844)
>  ERROR/AndroidRuntime(1451):     at
>  android.widget.FrameLayout.onLayout(FrameLayout.java:188)
>  ERROR/AndroidRuntime(1451):     at android.view.View.layout(View.java:
>  4844)
>  ERROR/AndroidRuntime(1451):     at
>  android.widget.LinearLayout.setChildFrame(LinearLayout.java:959)
>  ERROR/AndroidRuntime(1451):     at
>  android.widget.LinearLayout.layoutVertical(LinearLayout.java:846)
>  ERROR/AndroidRuntime(1451):     at
>  android.widget.LinearLayout.onLayout(LinearLayout.java:774)
>  ERROR/AndroidRuntime(1451):     at android.view.View.layout(View.java:
>  4844)
>  ERROR/AndroidRuntime(1451):     at
>  android.widget.FrameLayout.onLayout(FrameLayout.java:188)
>  ERROR/AndroidRuntime(1451):     at android.view.View.layout(View.java:
>  4844)
>  ERROR/AndroidRuntime(1451):     at
>  android.view.ViewRoot.performTraversals(ViewRoot.java:394)
>  ERROR/AndroidRuntime(1451):     at
>  android.view.ViewRoot.handleMessage(ViewRoot.java:584)
>  ERROR/AndroidRuntime(1451):     at
>  android.os.Handler.dispatchMessage(Handler.java:80)
>  ERROR/AndroidRuntime(1451):     at android.os.Looper.loop(Looper.java:
>  91)
>  ERROR/AndroidRuntime(1451):     at
>  android.app.ActivityThread.main(ActivityThread.java:3052)
>  ERROR/AndroidRuntime(1451):     at
>  java.lang.reflect.Method.invokeNative(Native Method)
>  ERROR/AndroidRuntime(1451):     at
>  java.lang.reflect.Method.invoke(Method.java:356)
>  ERROR/AndroidRuntime(1451):     at android.os.ZygoteInit
>  $MethodAndArgsCaller.run(ZygoteInit.java:1547)
>  ERROR/AndroidRuntime(1451):     at
>  android.os.ZygoteInit.main(ZygoteInit.java:1445)
>  ERROR/AndroidRuntime(1451):     at
>  android.dalvik.NativeStart.main(Native Method)
>
>
>
>  >
>



-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to