FileNotFoundException when cropping a photo
Posted
by James G
on Stack Overflow
See other posts from Stack Overflow
or by James G
Published on 2010-06-01T19:04:36Z
Indexed on
2010/06/01
23:43 UTC
Read the original article
Hit count: 214
I'm trying to crop a photo to use in a Live Wallpaper but I'm getting a FileNotFoundException when the crop activity tries to save my new cropped image. This is the code I'm using:
File file = new File(getFilesDir(), "wallpaper.jpg");
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setData(uri);
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
intent.putExtra("outputX", metrics.widthPixels * 2);
intent.putExtra("outputY", metrics.heightPixels);
intent.putExtra("aspectX", metrics.widthPixels * 2);
intent.putExtra("aspectY", metrics.heightPixels);
intent.putExtra("scale", true);
intent.putExtra("noFaceDetection", true);
intent.putExtra("output", Uri.parse("file:/" + file.getAbsolutePath()));
startActivityForResult(intent, REQUEST_CROP_IMAGE);
The wallpaper.jpg file seems to exist on DDMS file explorer so I'm not sure what I'm doing wrong. Any advice is greatly appreciated.
© Stack Overflow or respective owner