0

I have using a intent to fetch a image wise a gallery and camera.i got the image successful by startActivityForResult() but the image get in data fetch this data and get a image Url and set the Imageplaceholder but the image quality are very poor and image are blur.

    @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) {
        Uri selectedImage = data.getData();
        String[] filePathColumn = { MediaStore.Images.Media.DATA };

        Cursor cursor = getContentResolver().query(selectedImage,
                filePathColumn, null, null, null);
        cursor.moveToFirst();

        int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
        String picturePath = cursor.getString(columnIndex);
        cursor.close();

        try {
            bmp = getBitmapFromUri(selectedImage);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        image_view.setImageBitmap(bmp);

        //to know about the selected image width and height
        Toast.makeText(MainActivity.this, image_view.getDrawable().getIntrinsicWidth()+" & "+image_view.getDrawable().getIntrinsicHeight(), Toast.LENGTH_SHORT).show();
    }

}
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Ashwani kumar
  • 164
  • 15
  • check this - https://stackoverflow.com/a/20327697/7649582 – Asteroid Feb 19 '19 at 11:06
  • please read the question. my question to not resize the image its to set a original quality as same in gallery.? – Ashwani kumar Feb 19 '19 at 11:31
  • "I have using a intent to fetch a image wise a gallery and camera" -- there is nothing in your code that has anything to do with a camera. "but the image quality are very poor and image are blur" -- there may be an issue in your `getBitmapFromUri()` method. – CommonsWare Feb 19 '19 at 11:54

0 Answers0