3

I want the good quality image to show in ImageView and upload to the server. I have searched the Internet, StackOverflow and GitHub, but I could not find the answer, maybe somebody knows how can fix it?

protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { //work android
    super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
    imageReturnedIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);//try

    if (resultCode == RESULT_OK ) {// work every android than need click OK
      //working
        Uri selectedImage = imageReturnedIntent.getData();//convert to for bitmap that can send
        Bundle extras = imageReturnedIntent.getExtras();//finish converting and copy the image
        bitmap = extras.getParcelable("data");//receive image to bitmap
        imageView.setImageBitmap(bitmap);

onCreate:

btnCamera.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            //intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
            startActivityForResult(intent, 0);
        }
    });

What is wrong here?

lenik
  • 23,228
  • 4
  • 34
  • 43
evgeny
  • 35
  • 1
  • 6

1 Answers1

9

The Intent you send returns only low-quality picture as a small bitmap.

If you want the full-resolution image, you need to prepare the file where this image will be saved and provide all necessary information to the Camera application. The details are available at Save the full-size photo section, with all explanations and the code samples.

lenik
  • 23,228
  • 4
  • 34
  • 43
  • I don't want to save the image, but I want to send the image with a quality I take the picture. – evgeny Jun 30 '18 at 16:29
  • @evgeny there are 2 reasons why you cannot, 1) it's much easier to upload the file 2) `Intent` can hold only so much data, not enough for the hi-resolution picture. – lenik Jun 30 '18 at 16:32