I am trying to capture image and video from my android application with the default camera using Intent.
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, IMAGE_FROM_CAMERA);
Using above code i tried to capture Image and in onActivityResult
i am getting Null in the data at data.getData()
I tried with passing the Uri with the intent but the Uri gets Empty.
Camera intent is not able to write image on the uri. I need the uri to send image video with Email.
Error Log
07-26 21:16:54.125: E/AndroidRuntime(6142): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { act=inline-data (has extras) }} to activity {com.cam/com.cam.CameraDemoActivity}: java.lang.NullPointerException
07-26 21:16:54.125: E/AndroidRuntime(6142): at android.app.ActivityThread.deliverResults(ActivityThread.java:3712)
07-26 21:16:54.125: E/AndroidRuntime(6142): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3754)
07-26 21:16:54.125: E/AndroidRuntime(6142): at android.app.ActivityThread.access$2800(ActivityThread.java:135)
07-26 21:16:54.125: E/AndroidRuntime(6142): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2162)
07-26 21:16:54.125: E/AndroidRuntime(6142): at android.os.Handler.dispatchMessage(Handler.java:99)
07-26 21:16:54.125: E/AndroidRuntime(6142): at android.os.Looper.loop(Looper.java:143)
07-26 21:16:54.125: E/AndroidRuntime(6142): at android.app.ActivityThread.main(ActivityThread.java:4914)
07-26 21:16:54.125: E/AndroidRuntime(6142): at java.lang.reflect.Method.invokeNative(Native Method)
07-26 21:16:54.125: E/AndroidRuntime(6142): at java.lang.reflect.Method.invoke(Method.java:521)
07-26 21:16:54.125: E/AndroidRuntime(6142): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-26 21:16:54.125: E/AndroidRuntime(6142): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-26 21:16:54.125: E/AndroidRuntime(6142): at dalvik.system.NativeStart.main(Native Method)
07-26 21:16:54.125: E/AndroidRuntime(6142): Caused by: java.lang.NullPointerException
07-26 21:16:54.125: E/AndroidRuntime(6142): at com.cam.CameraDemoActivity.onActivityResult(CameraDemoActivity.java:48)
07-26 21:16:54.125: E/AndroidRuntime(6142): at android.app.Activity.dispatchActivityResult(Activity.java:3931)
07-26 21:16:54.125: E/AndroidRuntime(6142): at android.app.ActivityThread.deliverResults(ActivityThread.java:3708)
07-26 21:16:54.125: E/AndroidRuntime(6142): ... 11 more