Home > OS >  Android Java startActivity after onLongClickListener() in RecycleView
Android Java startActivity after onLongClickListener() in RecycleView

Time:11-04

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

CodePudding user response:

You can pass Context to save you some headaches.

private Context context;

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


  • Related