I am getting error while creating a Toast
Toast toast = Toast.makeText(this, text, duration);
I am getting cannot resolve ma
In the onClick(View view)
click listener within a RecyclerView.ViewHolder
the context is retrieved with view.getContext()
, as in:
```
public class MyHolder extends RecyclerView.ViewHolder implements
View.OnClickListener {
public MyHolder(View itemView) {
super(itemView);
//...
itemView.setOnClickListener(this);
}
@Override
public void onClick(View view) {
Toast.makeText(view.getContext(), "the message",
Toast.LENGTH_SHORT).show();
}
```