Rafael Muhamedzyanov Rafael Muhamedzyanov - 9 months ago 189
Android Question

How to get item from RecyclerView adapter in Android

In old code when I was using ListView with custom adapter I could get item with this code.

Message msg = (Message) adapter.getItem(poistion);

Now I am implementing RecyclerView. How can I get item from RecyclerView adapter?


You have to implement it yourself.

Add a new method in your custom Adapter and you are done.

public Message getItem(int position) {
  return messageList.get(position);