Access Gallery Specific Folder

0

I would like to know if it is possible for me to access a specific folder in the gallery, because I take pictures with my app and saved it in the gallery folder, but I wanted it when the user was selecting an image through my app, that he only access to this app folder. Below is code that accesses the gallery.

 public void loadImagefromGallery(View view) {
    Intent galleryIntent = new Intent(Intent.ACTION_PICK,
            android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    startActivityForResult(galleryIntent, SELECIONAR_IMAGEM);
}
    
asked by anonymous 30.08.2016 / 16:29

2 answers

0

Use this code:

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
    + "/myFolder/");
intent.setDataAndType(uri, "text/csv");
startActivity(Intent.createChooser(intent, "Open folder"));

Changing the myFolder to the name of the directory you created.

    
30.08.2016 / 16:37
0

What you want is a gallery filter, for the user to access only certain photos (of your app) through the native gallery application, right?

There's no way. I've gone after that and spent a lot of time trying to find a solution. You can open a single photo with the native image viewer, and nothing else. You can not open an array of photos with it, for example, nor open the native gallery with a filter.

The only solution is to create your own gallery. It is not very complex. You'll need to go after how to manage folders and files and how to use gridview, and most importantly, an imageloader for not crashing Android (I recommend Glide - link ). Remember to put dot before the folder name to prevent Android from fixing these photos in the native gallery. (/ photos instead of / photos)

    
31.08.2016 / 16:24