我对 android 中的裁剪功能有疑问。我使用 samsung gio 进行调试,并且 progect 和图像裁剪在此设备上运行良好。但是当我尝试在 Sony Experia S(Android 版本 4.0.4)和 Prestigio multipad(平板电脑 | Android 版本是 4.0.3)上运行这个项目时,我在 com.camera.android(标准相机 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
我必须做些什么来解决相机应用程序中的异常问题?或者可能是我有意传递了一些错误的参数?感谢您的任何建议。