I am developing an Android App which uploads an image from the camera or from the device photo gallery to remote site. The latter I have working fine, I can select and uplo
I think the problem is that you are still trying to access the thumbnail from the Intent
. In order to retrieve the full size image you need to access the file directly. So I'd recommend saving the file name before starting the camera activity and then loading the file at onActivityResult
.
I suggest reading Taking Photos Simply page from the official documentation where you'll find this quote regarding the thumbnail:
Note: This thumbnail image from "data" might be good for an icon, but not a lot more. Dealing with a full-sized image takes a bit more work.
Also in the very last section, you'll find the code you need:
private void setPic() {
// Get the dimensions of the View
int targetW = mImageView.getWidth();
int targetH = mImageView.getHeight();
// Get the dimensions of the bitmap
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
bmOptions.inJustDecodeBounds = true;
BitmapFactory.decodeFile(mCurrentPhotoPath, bmOptions);
int photoW = bmOptions.outWidth;
int photoH = bmOptions.outHeight;
// Determine how much to scale down the image
int scaleFactor = Math.min(photoW/targetW, photoH/targetH);
// Decode the image file into a Bitmap sized to fill the View
bmOptions.inJustDecodeBounds = false;
bmOptions.inSampleSize = scaleFactor;
bmOptions.inPurgeable = true;
Bitmap bitmap = BitmapFactory.decodeFile(mCurrentPhotoPath, bmOptions);
mImageView.setImageBitmap(bitmap);
}