I just looked at similar question in Stackoverflow, but haven't found an solution for it.
Everytime I try to capture a photo with my android app, it returns as a result a bitmap photo of an resolution of 240x360 px, although the camera is about 8 Megapixel.
So where is the mistake in my programmed code: (look at this screenshot)
private static final int TAKE_PHOTO_CODE = 1;
private static void takePhoto(){
final Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(getTempFile(thisOne.getBaseContext())) );
thisOne.startActivityForResult(intent, TAKE_PHOTO_CODE);
}
private static File getTempFile(Context context){
//it will return /sdcard/image.tmp
final File path = new File( Environment.getExternalStorageDirectory(), context.getPackageName() );
if(!path.exists()){
path.mkdir();
}
return new File(path, "image.tmp");
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
switch(requestCode){
case TAKE_PHOTO_CODE:
final File file = getTempFile(this);
try {
Bitmap captureBmp = MediaStore.Images.Media.getBitmap(getContentResolver(), Uri.fromFile(file));
int a = captureBmp.getHeight(); // RESULT 240
int b = captureBmp.getWidth(); // RESULT 360
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
break;
}
}
}
Thanks for your help