I'm with Drezden: I don't think that the code you've cited is
necessarily the code that is at fault.  I'd be inclined to look at the
constructor for com.android.databasetest.DatabaseTest

-blake

On Aug 25, 8:54 am, Abhi <abhishek.r.sha...@gmail.com> wrote:
> Hi
>
> I have the following piece of code which is resulting in a
> NullPointerException and I am not able to understand why. I am able to
> get the correct size of the bitmap in the Log statement below before
> displaying the image, so up to that point everything is good.
>
> //result is a byte array which contains the jpeg image
>
> ByteArrayInputStream inputStream = new ByteArrayInputStream(result);
> b = BitmapFactory.decodeStream(inputStream);
>
> Log.i(TAG, "Size of bitmap is " + b.getWidth() + " x " +
> b.getHeight());
>
> ImageView imageview1 = (ImageView) findViewById(R.id.ImageV);
> imageview1.setImageBitmap(b);
>
> The exception I am getting is below :
>
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564): FATAL EXCEPTION: main
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):
> java.lang.RuntimeException: Unable to start activity
> ComponentInfo{com.android.databasetest/
> com.android.databasetest.DatabaseTest}: java.lang.NullPointerException
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 1821)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> 1842)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> android.app.ActivityThread.access$1500(ActivityThread.java:132)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> android.os.Handler.dispatchMessage(Handler.java:99)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> android.os.Looper.loop(Looper.java:143)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> android.app.ActivityThread.main(ActivityThread.java:4263)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> java.lang.reflect.Method.invoke(Method.java:507)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:839)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> dalvik.system.NativeStart.main(Native Method)
>
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564): Caused by:
> java.lang.NullPointerException
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> com.android.databasetest.DatabaseTest.onCreate(DatabaseTest.java:62)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> 1072)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 1785)
> 08-25 11:46:25.578: ERROR/AndroidRuntime(12564):     ... 11 more
>
> Any help is appreciated.
>
> Thanks,
>
> AB

-- 
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

Reply via email to