Hello, I'm a beginner in android programming I'm developing an application that loads images from the user or camera gallery. After selecting the image I use a CropIntent to crop the image. The problem is that I can not scale the image to fit in ImageView, besides the image loses considerably the quality.
ImageView Xml:
<ImageView
android:id="@+id/ImageView"
android:layout_width="fill_parent"
android:layout_height="498dp"
android:layout_below="@+id/toolbar"
tools:layout_editor_absoluteX="11dp"
tools:layout_editor_absoluteY="61dp" />
This is the method I'm using to crop the image (Same method for camera and for gallery images):
private void CropImage() {
try{
CropIntent = new Intent("com.android.camera.action.CROP");
CropIntent.setDataAndType(uri,"image/*");
CropIntent.putExtra("crop","true");
CropIntent.putExtra("outputX",400);
CropIntent.putExtra("outputY",400);
CropIntent.putExtra("aspectX",3);
CropIntent.putExtra("aspectY",4);
CropIntent.putExtra("scaleUpIfNeeded",true);
CropIntent.putExtra("return-data",true);
startActivityForResult(CropIntent,1);
}
catch (ActivityNotFoundException ex)
{
}