I am currently creating an application that consists of a Fragment, an Adapter for a RecyclerView, and a RecyclerView which is accessed through the fragment. I need data to be passed from the RecyclerView back to the fragment however am unable to do so as the Fragment isn't identified through the Intent. When the user selects an item from the RecyclerView this item should be then passed through to the fragment. I have the RecyclerView using onBackPressed() to navigate back to the fragment which works fine. However, no data seems to pass. Please see below what I currently have in the onItemClick:
@Override
public void onItemClick(View view, int position) {
// Need to pass data through to Fragment, however unable to do so as it's not identified
// within the Intent
onBackPressed();
}