Grab gallery image on android

Asked

Viewed 878 times

-2

I would like it to open in the Image Gallery and not in Image

contactImgView.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                     Intent intent = new Intent(Intent.ACTION_VIEW, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); //coloquei assim, esta certo ?
            intent.setAction(Intent.ACTION_GET_CONTENT);
            intent.setType("image/*");
            startActivityForResult(Intent.createChooser(intent, "Select Contact Image"), 1);
       }
});

When I open by the emulated bluestack, instead of in the Intent open directly in the gallery, it opens in Image and then I need to select the gallery, but only that I wanted it to open direct in Gallery, have as ?

1 answer

0

Try to pass the URI of Media.EXTERNAL_CONTENT_URI.

Intent galeriaIntent = new Intent(Intent.ACTION_VIEW, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivity(galeriaIntent);
  • I put your code in exchange for mine, it’s opening the gallery now, only it’s not doing the other functions to grab the image I selected, I’ll edit the post

Browser other questions tagged

You are not signed in. Login or sign up in order to post.