When I choose a photo from the gallery it always turns 160 pixels in width and height. But the width and height I want is 640.
The code I use is below.
private void photoChooser(){
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
photoPickerIntent.setType("image/*");
photoPickerIntent.putExtra("crop", true );
photoPickerIntent.putExtra("aspectX",4);
photoPickerIntent.putExtra("aspectY",4);
photoPickerIntent.putExtra("outputX",640);
photoPickerIntent.putExtra("outputY",640);
photoPickerIntent.putExtra("return-data", true);
photoPickerIntent.putExtra("scale", true);
photoPickerIntent.putExtra("outputFormat",
Bitmap.CompressFormat.JPEG.toString());
startActivityForResult(photoPickerIntent, PICK_IMAGE);
}
the code I use to select photos;
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == PICK_IMAGE){
try{
final Bundle extras = data.getExtras();
if(extras != null){
Bitmap bitmap = extras.getParcelable("data");
lastImage = bitmap;
roundedBitmapDrawable2 =
RoundedBitmapDrawableFactory.create(this.getResources(),bitmap);
roundedBitmapDrawable2.setCircular(true);
imgProfile.setImageDrawable(roundedBitmapDrawable2);
}
}catch (Throwable ex){
ex.printStackTrace();
}
}
}
3 days I've been trying for this, but what I did not do. Thank you in advance for your help.