I\'m using RecyclerView
to list some text and now I want to make it so that when the user clicks on text a custom Alert Dialog box pops up.
I have tried
You are using context
which is null so pass the context
in ViewHolder
constructor and in CBAdapter constructor also like as below:
public class CBAdapter extends RecyclerView.Adapter {
List mItems;
Context context;
public CBAdapter(Context context) {
super();
this.context = context;
.....
}
And in ViewHolder class
class ViewHolder extends RecyclerView.ViewHolder{
public TextView textOne;
private Context mcontext;
public ViewHolder(View itemView, Context mcontext) {
super(itemView);
this.mcontext = mcontext;
....
}