Android相机异常(com.android.camera.action.CROP intent)

时间:2013-06-07 15:05:19

标签: android android-intent crop

我对android中的裁剪功能有疑问。我使用三星gio进行调试和progect和图像裁剪正在这个设备上工作。但是当我试图在索尼Experia S(Android版本4.0.4)和Prestigio multipad(平板电脑| Android版本是4.0.3)上运行这个项目时,我在com.camera.android(标准相机安卓应用程序,错误详情在下面添加)。所以相机启动,我正在拍照,点击确定按钮后,相机应用程序正在下降并给我一个错误。这是我的代码:

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString()); 
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 4);
intent.putExtra("aspectY", 3);
intent.putExtra("outputX", 200);
intent.putExtra("outputY", 150);
intent.putExtra("scale", false);
getOutputMediaFile(PICK_FROM_CAMERA);

try {
    intent.putExtra("return-data", true);
    startActivityForResult(intent, PICK_FROM_CAMERA);
} catch (Exception e) {
    e.toString();
}

堆栈追踪:

06-07 18:24:08.602: E/AndroidRuntime(18063): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=0, data=null} to activity 
    {com.newvision.firstteacher/com.newvision.firstteacher.AlphabetConstructorActivity}: java.lang.NullPointerException
06-07 18:24:08.602: E/AndroidRuntime(18063):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3319)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3362)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at android.app.ActivityThread.access$1100(ActivityThread.java:141)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at android.os.Looper.loop(Looper.java:137)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at android.app.ActivityThread.main(ActivityThread.java:5041)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at java.lang.reflect.Method.invokeNative(Native Method)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at java.lang.reflect.Method.invoke(Method.java:511)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at dalvik.system.NativeStart.main(Native Method)
06-07 18:24:08.602: E/AndroidRuntime(18063): Caused by: java.lang.NullPointerException
06-07 18:24:08.602: E/AndroidRuntime(18063):    at com.newvision.firstteacher.AlphabetConstructorActivity.onActivityResult(AlphabetConstructorActivity.java:270)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at android.app.Activity.dispatchActivityResult(Activity.java:5293)
06-07 18:24:08.602: E/AndroidRuntime(18063):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3315)
06-07 18:24:08.602: E/AndroidRuntime(18063):    ... 11 more

我必须做些什么来解决这个问题,在相机应用中出现异常?或者我可能是故意传递一些错误的参数? 谢谢你的任何建议。

0 个答案:

没有答案