kaeppler/ignition — Issue #1: NullPointerException in RemoteImageView
Author: sfarooq
Created: 2011-12-28 04:21:00+00:00
State: open

I'm using the RemoteImageView in a ListView. It works fine for one list but for another it gives the following error in Logcat.

12-28 14:25:44.843: E/AndroidRuntime(2617): FATAL EXCEPTION: main
12-28 14:25:44.843: E/AndroidRuntime(2617): java.lang.NullPointerException
12-28 14:25:44.843: E/AndroidRuntime(2617):	at com.github.ignition.support.images.remote.RemoteImageLoaderHandler.handleImageLoaded(RemoteImageLoaderHandler.java:73)
12-28 14:25:44.843: E/AndroidRuntime(2617):	at com.github.ignition.core.widgets.RemoteImageView$DefaultImageLoaderHandler.handleImageLoaded(RemoteImageView.java:228)
12-28 14:25:44.843: E/AndroidRuntime(2617):	at com.github.ignition.support.images.remote.RemoteImageLoaderHandler.handleImageLoadedMessage(RemoteImageLoaderHandler.java:52)
12-28 14:25:44.843: E/AndroidRuntime(2617):	at com.github.ignition.support.images.remote.RemoteImageLoaderHandler.handleMessage(RemoteImageLoaderHandler.java:45)
12-28 14:25:44.843: E/AndroidRuntime(2617):	at android.os.Handler.dispatchMessage(Handler.java:99)
12-28 14:25:44.843: E/AndroidRuntime(2617):	at android.os.Looper.loop(Looper.java:123)
12-28 14:25:44.843: E/AndroidRuntime(2617):	at android.app.ActivityThread.main(ActivityThread.java:3687)
12-28 14:25:44.843: E/AndroidRuntime(2617):	at java.lang.reflect.Method.invokeNative(Native Method)
12-28 14:25:44.843: E/AndroidRuntime(2617):	at java.lang.reflect.Method.invoke(Method.java:507)
12-28 14:25:44.843: E/AndroidRuntime(2617):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
12-28 14:25:44.843: E/AndroidRuntime(2617):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
12-28 14:25:44.843: E/AndroidRuntime(2617):	at dalvik.system.NativeStart.main(Native Method)

NOTE: the actual line number for the exception in RemoteImageLoaderHandler.java is 71. I added lines to see where the exact problem was.

It seems that a null Bitmap is passed to the RemoteImageLoaderHandler and because I get the RemoteImageView from a findViewById(), I don't have an errorDrawable so the NullPointerException is passed.

I believe the problem is initiated at line 51 in RemoteImageHandler.java

Bitmap bitmap = data.getParcelable(BITMAP_EXTRA);

Maybe I'm doing something wrong. Any ideas ?