1

I am getting java.lang.RuntimeException when i am trying to select store the image from gallery to imageview.i am using two intents.

1.Take Picture and store in imageview
2.choose from gallery

But when i am using this code MainActivity.java i am getting that exception in stoing the image of camera and when i am using this code MainActivity.java then getting the error in storing the image of gallery. What is the wrong on that codes.

if it works for camera image then its not work for gallery and if its work for gallery then not working for camera images . why?

Here is my log cat of setting image of camera.

08-30 17:37:57.218: E/AndroidRuntime(8877): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { act=inline-data (has extras) }} to activity {org.inextrix.userprofile/org.inextrix.userprofile.MainActivity}: java.lang.NullPointerException
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.ActivityThread.deliverResults(ActivityThread.java:2536)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:2578)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.ActivityThread.access$2000(ActivityThread.java:117)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:965)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.os.Looper.loop(Looper.java:130)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.ActivityThread.main(ActivityThread.java:3687)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at java.lang.reflect.Method.invokeNative(Native Method)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at java.lang.reflect.Method.invoke(Method.java:507)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at dalvik.system.NativeStart.main(Native Method)
08-30 17:37:57.218: E/AndroidRuntime(8877): Caused by: java.lang.NullPointerException
08-30 17:37:57.218: E/AndroidRuntime(8877):     at org.inextrix.userprofile.MainActivity.onActivityResult(MainActivity.java:77)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.Activity.dispatchActivityResult(Activity.java:3908)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.ActivityThread.deliverResults(ActivityThread.java:2532)
08-30 17:37:57.218: E/AndroidRuntime(8877):     ... 11 more

Anyone had this problem before or i am doing something wrong. if you any idea then suggest me
Thanks

Juned
  • 6,192
  • 7
  • 43
  • 91

1 Answers1

3

For the problem with the gallery I think this and this should help you.

Community
  • 1
  • 1
Mr.S
  • 139
  • 9
  • Then would that "http://android-coding.blogspot.ch/2011/06/pick-contact-using-intent-of.html" be more helpful? I've already reviewd your code... tipp on line 59 par example: initialize never like you have done... "Bitmap bitmap = null;" use "Bitmap bitmap = new Bitmap();" – Mr.S Aug 30 '12 at 13:56
  • Thanks for response,i should check my code once again. and yeah i think the given link is dead can you provide me the updated link? – Juned Aug 30 '12 at 14:03
  • yeah my problem is solved using this link http://www.londatiga.net/featured-articles/how-to-select-and-crop-image-on-android/comment-page-2/#comment-14194 – Juned Aug 31 '12 at 10:07