Android Java startActivity after onLongClickListener() in RecycleView

Issue

I would like to go UpdateLanguageActivity when I press a long click on each row of RecyvleView. But I can’t create new Intent() in this context. I tried to google for the result, but there are only onLongClickListener() with ListView.

enter image description here

enter image description here

enter image description here

Solution

You can pass Context to save you some headaches.

private Context context;

public MyViewHolder(Context context, View itemView) {
     this.context = context
}


Answered By – Lawrence Gimenez

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published