A small photo taken from the camera, although MediaStore.EXTRA_OUTPUT is specified in 2.X

I just don’t understand: when I use the camera with the intention, and also specify the output file, the returned image is always very small on many devices (for example, Motorola Milestone 2.1, HTC Desire 2.1, emulator 2.1, emulator 2.0.1), but not at all (e.g. Nexus One). Here is what I do to open the camera app:

private final static String TEMP_PHOTO_FILE = Environment.getExternalStorageDirectory() + "/TEMP_PHOTO.JPG";  
private final static int REQUEST_CAMERA = 0;  
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);  
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(TEMP_PHOTO_FILE)));  
startActivityForResult(intent, REQUEST_CAMERA);

After the image has been executed, I get its result in onActivityResult(int requestCode, int resultCode, Intent data):

if (requestCode == REQUEST_CAMERA && resultCode == RESULT_OK) {  
    String photo = MediaHandler.moveFile(TEMP_PHOTO_FILE, MediaHandler.SDCARD_IMAGE_PATH, System.currentTimeMillis());  
    BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();  
    // bitmapOptions.inSampleSize = 6;  
    imgBitmap = BitmapFactory.decodeFile(photo, bitmapOptions);  

The bitmap is pretty small and I wonder why this is happening. I know that it worked correctly.
Does anyone have the same problem or even a hint on how to fix this?

Thanks
Stef

+3

Source: https://habr.com/ru/post/1744480/


All Articles