In the application I use sqlile, in which one column is a picture. The table simply stores the name in the form of "image1.ipg" pictures themselves are in the assets folder.

Adapter where everything happens

public class FavoriteAdapter extends RecyclerView.Adapter<FavoriteAdapter.VersesViewHolder> { class VersesViewHolder extends RecyclerView.ViewHolder { private final TextView tv_title; private final ImageView image; private VersesViewHolder(View itemView) { super(itemView); tv_title = itemView.findViewById(R.id.tvTitle); image = itemView.findViewById(R.id.imageView); } } private final LayoutInflater inflater; private List<Verses> verses; public FavoriteAdapter(Context context) { inflater = LayoutInflater.from(context); } @Override public VersesViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = inflater.inflate(R.layout.rv_item, parent, false); return new VersesViewHolder(itemView); } @Override public void onBindViewHolder(VersesViewHolder holder, int position) { Verses current = verses.get(position); holder.tv_title.setText(current.title); // Picasso.get().load("file:///android_asset/DvpvklR.png").into(current.image); } public void setVerses(List<Verses> verses) { this.verses = verses; notifyDataSetChanged(); } @Override public int getItemCount() { if (verses != null) return verses.size(); else return 0; } } 

The commented line is an example from the documentation. I can not figure out how to replace a link to a specific picture ("file: ///android_asset/DvpvklR.png") to write code that loads a picture of the corresponding item-a

    1 answer 1

    Do this: String imgName = "file:///android_asset/image"+position;

    or so: String imgName = "file:///android_asset/"+current.getImgName();

    Then:
    Picasso.get().load(imgName).into(holder.image);

    You can immediately write the full path to Verses and do this: Picasso.get().load(current.getImage()).into(holder.image);