You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Hisham Abdel-Hafez (JIRA)" <ji...@apache.org> on 2013/03/11 18:29:14 UTC
[jira] [Created] (CB-2647) camera.getPicture crashes application
when you provide a target width and height
Hisham Abdel-Hafez created CB-2647:
--------------------------------------
Summary: camera.getPicture crashes application when you provide a target width and height
Key: CB-2647
URL: https://issues.apache.org/jira/browse/CB-2647
Project: Apache Cordova
Issue Type: Bug
Components: Android
Affects Versions: 2.2.0
Environment: Tested it on HTC Sensation running Android 4.0.3 and Samsung Galaxy S2 running Android 2.3.4
Reporter: Hisham Abdel-Hafez
Assignee: Joe Bowser
Priority: Critical
When I try to use camera.getPicture to capture photo from gallery providing a target width and height, then select some other application other than the default android gallery (happens always with File Manager https://play.google.com/store/apps/details?id=com.rhmsoft.fm)
My application crashes. The code I use is:
navigator.camera.getPicture( onPhotoSuccess, onPhotoError, {
destinationType : navigator.camera.DestinationType.FILE_URI,
quality : 49,
sourceType : navigator.camera.PictureSourceType.PHOTOLIBRARY,
allowEdit : true,
encodingType : navigator.camera.EncodingType.JPEG,
targetWidth : this.targetWidth,
targetHeight : this.targetHeight,
mediaType : navigator.camera.MediaType.Picture,
saveToPhotoAlbum : true
});
the method fails gracefully (calling the errorCallBack) if I do not supply a target width or height. But if I supply them, the application crashes throwing this exception:
03-10 09:05:09.991: D/AndroidRuntime(3800): Shutting down VM
03-10 09:05:09.991: W/dalvikvm(3800): threadid=1: thread exiting with uncaught exception (group=0x40ad1228)
03-10 09:05:10.001: E/AndroidRuntime(3800): FATAL EXCEPTION: main
03-10 09:05:10.001: E/AndroidRuntime(3800): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=18, result=-1, data=Intent { dat=file:///mnt/sdcard/APP_NAME/Photo_20130307221629.jpg }} to activity {com.APP_NAME/com.APP_NAME.APP_NAME}: java.lang.NullPointerException
03-10 09:05:10.001: E/AndroidRuntime(3800): at android.app.ActivityThread.deliverResults(ActivityThread.java)
03-10 09:05:10.001: E/AndroidRuntime(3800): at android.app.ActivityThread.handleSendResult(ActivityThread.java)
03-10 09:05:10.001: E/AndroidRuntime(3800): at android.app.ActivityThread.access$1100(ActivityThread.java)
03-10 09:05:10.001: E/AndroidRuntime(3800): at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
03-10 09:05:10.001: E/AndroidRuntime(3800): at android.os.Handler.dispatchMessage(Handler.java)
03-10 09:05:10.001: E/AndroidRuntime(3800): at android.os.Looper.loop(Looper.java)
03-10 09:05:10.001: E/AndroidRuntime(3800): at android.app.ActivityThread.main(ActivityThread.java)
03-10 09:05:10.001: E/AndroidRuntime(3800): at java.lang.reflect.Method.invokeNative(Native Method)
03-10 09:05:10.001: E/AndroidRuntime(3800): at java.lang.reflect.Method.invoke(Method.java)
03-10 09:05:10.001: E/AndroidRuntime(3800): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
03-10 09:05:10.001: E/AndroidRuntime(3800): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
03-10 09:05:10.001: E/AndroidRuntime(3800): at dalvik.system.NativeStart.main(Native Method)
03-10 09:05:10.001: E/AndroidRuntime(3800): Caused by: java.lang.NullPointerException
03-10 09:05:10.001: E/AndroidRuntime(3800): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java)
03-10 09:05:10.001: E/AndroidRuntime(3800): at org.apache.cordova.CameraLauncher.getScaledBitmap(CameraLauncher.java:571)
03-10 09:05:10.001: E/AndroidRuntime(3800): at org.apache.cordova.CameraLauncher.onActivityResult(CameraLauncher.java:396)
03-10 09:05:10.001: E/AndroidRuntime(3800): at org.apache.cordova.DroidGap.onActivityResult(DroidGap.java:812)
03-10 09:05:10.001: E/AndroidRuntime(3800): at com.worklight.androidgap.WLDroidGap.onActivityResult(WLDroidGap.java:237)
03-10 09:05:10.001: E/AndroidRuntime(3800): at android.app.Activity.dispatchActivityResult(Activity.java)
03-10 09:05:10.001: E/AndroidRuntime(3800): ... 12 more
03-10 09:05:10.011: E/EmbeddedLogger(303): App crashed! Process: com.APP_NAME
03-10 09:05:10.011: E/EmbeddedLogger(303): App crashed! Package: com.APP_NAME v306 (0.1)
03-10 09:05:10.011: E/EmbeddedLogger(303): Application Label: APP LABEL
03-10 09:05:10.011: W/ActivityManager(303): Force finishing activity com.APP_NAME/.APP_NAME
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira