Question: I'm developing a chat application. There are chatrooms and inside these rooms there are messages. When a user clicks on the chatroom I want to go to another activity where messages are displayed. 

In my adapter class, I have this `onclick()` method written in `onBindViewHolder` where I would normally make an intent along with the data I need. Something like this:

```
@Override
public void onBindViewHolder(@NonNull ChatRoomAdapter.ChatRoomViewHolder holder, final int position) {
    holder.mRoomTitle.setText(mChatRooms.get(position).getTitle());
    holder.mRoomDescription.setText(mChatRooms.get(position).getDescription());

    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(this, NextActivity.java);
            intent.putExtra("test", mChatRooms.get(position).getTitle());
        }
    });
}

```

But I'm trying the MVP architecture design and I want to pass `roomTitle` to the Interactor/presenter class of my next activity. How can I achieve this?

Answer: 
In RecyclerView adapter you need to pass a onItemClickListener in the adapter.

Refer to the Google's MVP sample - > <https://github.com/googlesamples/android-architecture/tree/todo-mvp/>

Especially refer the TaskItemListener in TaskFragment. They are doing the same thing what you are trying to achieve. In this they open Task details (new activity) from List of tasks(recyclervView).

```
/**
 * Listener for clicks on tasks in the ListView.
 */
TaskItemListener mItemListener = new TaskItemListener() {
    @Override
    public void onTaskClick(Task clickedTask) {
        mPresenter.openTaskDetails(clickedTask);
    }

    @Override
    public void onCompleteTaskClick(Task completedTask) {
        mPresenter.completeTask(completedTask);
    }

    @Override
    public void onActivateTaskClick(Task activatedTask) {
        mPresenter.activateTask(activatedTask);
    }
};

```

And then pass it to adapter of Recycler view 

```
mListAdapter = new TasksAdapter(new ArrayList<Task>(0), mItemListener);

```

And on item click 

```
rowView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mItemListener.onTaskClick(task);
            }
        });

```
Follow this [article](https://medium.com/cr8resume/make-you-hand-dirty-with-mvp-model-view-presenter-eab5b5c16e42) to know more about MVP.

You can do one thing that creates a method in the next activity's presenter 

```
setRoomTitle(String roomTitle);

```

Whenever, you click and send intent and get in next Activity call that 

```
mPresenter.setRoomTitle(roomTitle);

```

Is it make sense? So, you can sent your title or other data in next activity's presenter. 

Let me know if you have more query then.

Thanks.

Happy coding :)