title: How to pass or send data from recyclerview adapter to fragment
body: <p>How to pass data from recyclerview adapter to fragment and what i have to write the code in fragment to receive data.I have already check the links in this website but unfortunately unable to get correct code.
  Below is the code</p>
  
  <blockquote>
    <p>ExampleAdapter.Java</p>
  </blockquote>
  
  <pre><code>public class ExampleAdapter extends RecyclerView.Adapter&lt;ExampleAdapter.ExampleViewHolder&gt; {
      private ArrayList&lt;ExampleItem&gt; mExampleList;
      @NonNull
      @Override
      public ExampleViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
          View v=LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.example_item,viewGroup,false);
          ExampleViewHolder evh=new ExampleViewHolder(v);
          return evh;
      }
      @Override
      public void onBindViewHolder(@NonNull ExampleViewHolder exampleViewHolder, int i) {
          final ExampleItem currentItem=mExampleList.get(i);
          exampleViewHolder.mTextView.setText(currentItem.getmText());
          exampleViewHolder.mTextView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  // pass the data to the fragment
              }
          });
      }
      @Override
      public int getItemCount() {
          return mExampleList.size();
      }
      public static class ExampleViewHolder extends RecyclerView.ViewHolder {
          public TextView mTextView;
          public ExampleViewHolder(@NonNull View itemView) {
              super(itemView);
              mTextView=itemView.findViewById(R.id.texttitle);
          }
      }
      public ExampleAdapter(ArrayList&lt;ExampleItem&gt; exampleList){
                this.mExampleList=exampleList;
  }
  }
  </code></pre>