Huseyin Baduk Huseyin Baduk - 2 months ago 16
Android Question

Android - Recyclerview adapter show Images from External Storage

I want create image gallery with RecyclerView where use images from phone. I didn't find any RecyclerView adapter which fill image with File type. Is it possible?

Answer

For basic functionality of RecyclerView adapters: http://guides.codepath.com/android/Using-the-RecyclerView

In your onBindViewHolder, you can get your image like this:

String path = Environment.getExternalStorageDirectory() + "/myImage.jpg";
Bitmap bitmap = BitmapFactory.decodeFile(path);

(more info on getting images from external storage)

and use it with an ImageView or something similar.

Comments