File explorer to display INTERNAL STORAGE images

I believe that this question is an easy one for yours, but a very difficult one for me.

I'm developing an Android application that, among other functionalities, should provide users a way to select multiple pre-defined images. Since those images will be private and they will not be downloaded from any site, I thought to include them in the INTERNAL STORAGE of the application. Then, I just created a raw folder in the resource tree of the Android Studio project, and I placed several images there. My intention is to create a File Explorer dialog that displays those images, in order to allow users to select several ones. I tried to implement the native Android File Explorer, but it doesn't seem to have access to the INTERNAL STORAGE.

What is the most optimal way to develop this? Is there any file dialog class to help me doing so? Would it be better to place the images on the EXTERNAL STORAGE? How could I do it?

I don't want any code to help me with this, just a few guidelines! :)

Thank you

Upvotes: 0

Views: 134

Answers (1)

Serg Burlaka
Serg Burlaka

Reputation: 2496

Can you try to use assets? Look example code

// load image

try 
{   
    InputStream ims = getAssets().open("avatar.jpg");
    Drawable d = Drawable.createFromStream(ims, null);  
    mImage.setImageDrawable(d);
    ims .close();
}
catch(IOException ex) 
{
    return;
}

Upvotes: 1

Related Questions