Skip to content Skip to sidebar Skip to footer

How To Take Textview Data From Recycler View To Another Activity?

I want to take textview data from recycler view to another activity.I want to take workshop_name TextView to Otheractivity. Here is my code. MechSearchActivity.java public class M

Solution 1:

For that you need to create one interface in your MechanicRecyclerAdapter

publicinterfaceOnListItemClick {
    voidonItemClick(int position);
}

in onBindViewHolder() assign your click by using following code

viewHolder.main_layout.setOnClickListener(newView.OnClickListener() {
            @OverridepublicvoidonClick(View v) {
                onListItemClick.onItemClick(position);
            }
        });

Implements this interface in you MechSearchActivity you will get onItemClick() method in your activity using position you will get proper name of row and pass to other activity using intent.putExtra("workshop_name", workshop_name);

Post a Comment for "How To Take Textview Data From Recycler View To Another Activity?"