title: How pass data from RecyclerView to activity
body: <p>I need to pass data from <code>recyclerView</code> <code>adapter</code> to <code>main</code> <code>activity</code> on click on image of recyclerview. Can someone help?</p>
  
  <pre><code>public  class VideoAdapter extends RecyclerView.Adapter&lt;VideoAdapter.VideoHolder&gt; {
      private ArrayList&lt;Video&gt; mData;
      private ArrayList&lt;Video&gt; mData2;
  
  
      private Activity mACtivity;
  
      public VideoAdapter(ArrayList&lt;Video&gt; data, ArrayList&lt;Video&gt; data2, Activity activity) {
          this.mData = data;
          this.mData2 = data2;
  
          this.mACtivity = activity;
      }
  
  
      @Override
      public VideoHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.anteprima_list_item, parent, false);
          //view.setOnClickListener(mOnClickListener);
  
          return new VideoHolder(view);
      }
  
      @Override
      public void onBindViewHolder(VideoHolder holder, int position) {
          Video video = mData.get(position);
          final Video video2 = mData2.get(position);
  
          holder.setTitolo(video.getTitolo());
          holder.setSottoTitolo(video.getSottotitolo());
  
          holder.setData(video.getData());
  
          holder.setData(video.getData());
  
  
         /* holder.setAddress(restaurant.getAddress());
          holder.setCost("Average cost for 2: " + restaurant.getCurrency() + restaurant.getCost());
          holder.setRating(restaurant.getRating());*/
  
          Glide.with(mACtivity)
                  .load(video2.getPic())
                  .into(holder.restaurantImageView);
  
          holder.restaurantImageView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  // handle click event here
                  System.out.println("PIC"+video2.getPic());
              }
          });
  
      }
  
      @Override
      public int getItemCount() {
          if (mData == null)
              return 0;
          return mData.size();
      }
  
      public class VideoHolder extends RecyclerView.ViewHolder {
  
          ImageView restaurantImageView;
          TextView restaurantNameTextView;
          TextView restaurantAddressTextView;
          TextView restaurantRatingTextView;
          TextView costTextView;
          TextView distanceTextView;
          LinearLayout linearlayout;
  
          public VideoHolder(View itemView) {
              super(itemView);
               linearlayout=(LinearLayout) itemView.findViewById((R.id.linearlayout));
  
              restaurantImageView = (ImageView) itemView.findViewById(R.id.imageview_restaurant);
              restaurantNameTextView = (TextView) itemView.findViewById(R.id.textview_restaurant_name);
              restaurantAddressTextView = (TextView) itemView.findViewById(R.id.restaurant_address_textview);
              distanceTextView = (TextView) itemView.findViewById(R.id.restaurant_distance_textview);
             /*  costTextView = (TextView) itemView.findViewById(R.id.cost_for_two_textview);
  
             restaurantRatingTextView = (TextView) itemView.findViewById(R.id.rating);*/
  
  
          }
  
  
          public void setTitolo(String titolo) {
              restaurantNameTextView.setText(titolo);
          }
  
          public void setSottoTitolo(String sottotitolo) {
              restaurantAddressTextView.setText(sottotitolo);
          }
  
          public void setData(String data) {
              distanceTextView.setText(data);
          }
        /*  public void setPic(String pic) {
              distanceTextView.setText(pic);
          }
  
           public void setCost(String cost) {
              costTextView.setText(cost);
          }
  
          public void setDistance(String distance) {
              distanceTextView.setText(distance);
          }*/
      }
  }
  </code></pre>