1

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?

Huseyin
  • 567
  • 6
  • 17

2 Answers2

1

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.

Community
  • 1
  • 1
Felix Edelmann
  • 4,959
  • 3
  • 28
  • 34
1

It's works

@Override
public void onBindViewHolder(RecyclerViewHolders holder, int position) {
    holder.countryName.setText("Img");
    Bitmap bitmap = BitmapFactory.decodeFile(newList.get(position));
    holder.countryPhoto.setImageBitmap(bitmap);
}
Huseyin
  • 567
  • 6
  • 17