Gallery活动的问题

时间:2011-02-16 16:05:44

标签: android android-activity android-gallery

我关注如何在[android-developer] [1]

上制作活动图库

[1]:http://developer.android.com/guide/tutorials/views/hello-gallery.html但我收到了下一个错误:

    02-12 17:54:06.221: ERROR/AndroidRuntime(1330): Uncaught handler: thread main exiting due to uncaught exception
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.addsensor.CameraMap/com.addsensor.CameraMap.GalleryCamera}: java.lang.NullPointerException
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at android.app.ActivityThread.access$1800(ActivityThread.java:112)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at android.os.Handler.dispatchMessage(Handler.java:99)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at android.os.Looper.loop(Looper.java:123)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at android.app.ActivityThread.main(ActivityThread.java:3948)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at java.lang.reflect.Method.invokeNative(Native Method)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at java.lang.reflect.Method.invoke(Method.java:521)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at dalvik.system.NativeStart.main(Native Method)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330): Caused by: java.lang.NullPointerException
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at com.addsensor.CameraMap.GalleryCamera.onCreate(GalleryCamera.java:20)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
    02-12 17:54:06.301: ERROR/AndroidRuntime(1330):     at 

android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)

我还在[stackoverflow] [1]

上更改了有人评论的内容

[1]:Android Hello, Gallery tutorial -- "R.styleable cannot be resolved"但我仍然收到错误。这是一个简单的活动,我不知道如何遵循。任何人都知道?¿或如何解决?¿

感谢

1 个答案:

答案 0 :(得分:1)

您正试图在CameraMap.GalleryCamera,onCreate()方法第20行中使用null引用(例如变量未初始化等等。)

请发布此方法的代码(并注明行号20)。