-1

i am trying to upload image from gallery and display it on image view but i am getting this error

I/System.out: resolveUri failed on bad bitmap uri: content://media/external/images/media/35

my code:

 public void btimage(View view)
    {

        Intent i = new Intent(
                Intent.ACTION_PICK,
                MediaStore.Images.Media.INTERNAL_CONTENT_URI);

        startActivityForResult(i, 100);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data)
    {
        super.onActivityResult(requestCode, resultCode, data);

        if(requestCode==100 && resultCode==RESULT_OK)
        {
            Uri uri= data.getData();
            imgView.setImageURI(uri);

        }
    }
m.karman
  • 65
  • 1
  • 1
  • 4

1 Answers1

0

try this

android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI

for

MediaStore.Images.Media.INTERNAL_CONTENT_URI
Assem Mahrous
  • 411
  • 3
  • 15