Within my Recycler Adapter, I have the following:
public void onBindViewHolder(ViewHolder holder, int position) {
User userItem = mDataset.get(position);
holder.itemView.setTag(userItem);
...
}
Within my layout, I have a clickable element:
...
<FrameLayout
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="@color/white"
android:layout_marginRight="15dp"
android:layout_marginBottom="15dp"
android:onClick="showActivity">
...
On click, it should show the next Activity. I need to pass the tag that I attached to it so that I can use the data in the next Activity.
Here is showActivity
within my activity:
public void showActivity(View view) {
Intent intent = new Intent(this, SecondActivity.class);
// pass the model to the next activity
startActivity(intent);
}
How can I do this?