I'm capturing an image from camera and then saving it do sqlite database.
After that I allow user to crop it. After the whole process quality is very very poor.
I'm testing it on Nexus7 and I know it's front camera is poor but right after crop app opens, the picture is very small. It takes like 1/5 of s creen in the crop activity and I don't know why.
This what happens onActivityResult
(capturing taken picture)
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) {
Bitmap bitmap = (Bitmap) data.getExtras().get("data");
String path = Images.Media.insertImage(getActivity().getContentResolver(), bitmap, "Title", null);
Uri imageUri = Uri.parse(path);
if (!doCrop(imageUri)) saveNewAvatar(bitmap);
}
}
And here is doCrop(Uri uri)
method:
private void doCrop(final Uri imageUri) {
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setType("image/*");
List<ResolveInfo> list = getActivity().getPackageManager().queryIntentActivities( intent, 0 );
int size = list.size();
intent.setData(imageUri);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);
if (size == 1) {
Intent i = new Intent(intent);
ResolveInfo res = list.get(0);
i.setComponent( new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
startActivityForResult(i, CROP);
}
}
After the whole process picture is very very small.
EDIT: Did some research and followed code from this thread
Ended up with this: