Given an adapter like this:
public class MyAdapter extends RecyclerView.Adapter {
private final Activity mActivity;
private final List<Item> mItemList;
public MyAdapter(Activity activity, List<Item> itemList) {
this.mActivity = activity;
this.mItemList = itemList;
}
//[...]
public void onBindViewHolder(ViewHolder holder, int position) {
final Item i = mItemList.get(position);
holder.launchButton.setOnClickListener(new OnClickListener() {
@Override public void onClick(View v) {
mActivity.startActivity(i.getIntent());
});
}
}
As you can see, the activity instance is needed for launch the intents. Of course, there are other ways to do that (e.g. using interfaces) but the point of the question is if it is safe to keep the hard reference to mActivity instance in the adapter