title: How to set OnClick For a Recycler View Item Toast with position
body: <p>I have Just Created a recycler View that contains Cards All I want to setOnCLick for this recycler view toast with a position item Click as It's ma first time to use a recycler view I always use a list View with a setOnItemClickListner so
  Here's my Adapter Class</p>
  
  <pre><code>package abtech.waiteriano.com.retailstar.adapters;
  
  import android.content.Context;
  import android.support.v7.widget.CardView;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  
  import java.util.List;
  
  import abtech.waiteriano.com.retailstar.R;
  
  public class RVAdapter extends RecyclerView.Adapter&lt;RVAdapter.PersonViewHolder&gt; {
  
      public static class PersonViewHolder extends RecyclerView.ViewHolder {
  
          CardView cv;
          Context c;
          TextView InvoiceNumber;
          TextView InvoiceType;
          TextView InvoiceDate;
          TextView Status;
          TextView CustomerID;
  
          PersonViewHolder(View itemView) {
              super(itemView);
              cv = (CardView)itemView.findViewById(R.id.cv);
              InvoiceNumber = (TextView)itemView.findViewById(R.id.invoiceNo);
              InvoiceType = (TextView)itemView.findViewById(R.id.tvType);
              InvoiceDate = (TextView)itemView.findViewById(R.id.tvDate);
              Status = (TextView)itemView.findViewById(R.id.statusTv);
              CustomerID = (TextView)itemView.findViewById(R.id.cutomerId);
          }
      }
  
      List&lt;Invoice&gt; Invoices;
  
      RVAdapter(List&lt;Invoice&gt; Invoices){
          this.Invoices = Invoices;
      }
  
      @Override
      public void onAttachedToRecyclerView(RecyclerView recyclerView) {
          super.onAttachedToRecyclerView(recyclerView);
      }
  
      @Override
      public PersonViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
          View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item, viewGroup, false);
          PersonViewHolder pvh = new PersonViewHolder(v);
          return pvh;
      }
  
      @Override
      public void onBindViewHolder(PersonViewHolder personViewHolder, int i) {
          personViewHolder.InvoiceNumber.setText(Invoices.get(i).invoiceNo);
          personViewHolder.InvoiceType.setText(Invoices.get(i).invoiceType);
          personViewHolder.InvoiceDate.setText(Invoices.get(i).invoiceDate);
          personViewHolder.Status.setText(Invoices.get(i).status);
          personViewHolder.CustomerID.setText(Invoices.get(i).cutomerId);
  
      }
  
      @Override
      public int getItemCount() {
          return Invoices.size();
      }
  }
  </code></pre>
  
  <p>and here's the fragment class which contains the recycler VIew</p>
  
  <pre><code>package abtech.waiteriano.com.retailstar.adapters;
  
  import android.net.Uri;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import abtech.waiteriano.com.retailstar.R;
  
  /**
   * A simple {@link Fragment} subclass.
   * Activities that contain this fragment must implement the
   * {@link InvoiceFragment.OnFragmentInteractionListener} interface
   * to handle interaction events.
   * Use the {@link InvoiceFragment#newInstance} factory method to
   * create an instance of this fragment.
   */
  public class InvoiceFragment extends Fragment {
      // TODO: Reinvoice_number parameter arguments, choose invoice_numbers that match
      View rootView;
      private List&lt;Invoice&gt; Invoices;
      private RecyclerView rv;
  
  
  
  
      // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
      private static final String ARG_PARAM1 = "param1";
      private static final String ARG_PARAM2 = "param2";
  
      // TODO: Reinvoice_number and change types of parameters
      private String mParam1;
      private String mParam2;
  
      private OnFragmentInteractionListener mListener;
  
      public InvoiceFragment() {
          // Required empty public constructor
      }
  
      /**
       * Use this factory method to create a new instance of
       * this fragment using the provided parameters.
       *
       * @param param1 Parameter 1.
       * @param param2 Parameter 2.
       * @return A new instance of fragment InvoiceFragment.
       */
      // TODO: Reinvoice_number and change types and number of parameters
      public static InvoiceFragment newInstance(String param1, String param2) {
          InvoiceFragment fragment = new InvoiceFragment();
          Bundle args = new Bundle();
          args.putString(ARG_PARAM1, param1);
          args.putString(ARG_PARAM2, param2);
          fragment.setArguments(args);
          return fragment;
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          if (getArguments() != null) {
              mParam1 = getArguments().getString(ARG_PARAM1);
              mParam2 = getArguments().getString(ARG_PARAM2);
          }
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          rootView = inflater.inflate(R.layout.fragment_invoice, container, false);
          rv=(RecyclerView)rootView.findViewById(R.id.rv);
  
          LinearLayoutManager llm = new LinearLayoutManager(getContext());
          rv.setLayoutManager(llm);
          rv.setHasFixedSize(true);
  
          initializeData();
          initializeAdapter();
  
  
          return rootView;
  
      }
      private void initializeData(){
          Invoices = new ArrayList&lt;&gt;();
          Invoices.add(new Invoice("204", "Regular","15/5/2017","Regular","100200000194"));
          Invoices.add(new Invoice("205", "Regular","20/5/2017","Regular","100200000195"));
          Invoices.add(new Invoice("206", "Regular","30/5/2017","Regular","100200000196"));
          Invoices.add(new Invoice("207", "Regular","5/6/2017","Regular","100200000197"));
          Invoices.add(new Invoice("208", "Regular","10/6/2017","Regular","100200000198"));
          Invoices.add(new Invoice("209", "Regular","15/6/2017","Regular","100200000199"));
          Invoices.add(new Invoice("210", "Regular","20/6/2017","Regular","100200000200"));
          Invoices.add(new Invoice("211", "Regular","25/6/2017","Regular","100200000201"));
          Invoices.add(new Invoice("212", "Regular","30/6/2017","Regular","100200000202"));
      }
  
      private void initializeAdapter(){
          RVAdapter adapter = new RVAdapter(Invoices);
          rv.setAdapter(adapter);
      }
  
      // TODO: Reinvoice_number method, update argument and hook method into UI event
      public void onButtonPressed(Uri uri) {
          if (mListener != null) {
              mListener.onFragmentInteraction(uri);
          }
      }
  
      @Override
      public void onDetach() {
          super.onDetach();
          mListener = null;
      }
  
      /**
       * This interface must be implemented by activities that contain this
       * fragment to allow an interaction in this fragment to be communicated
       * to the activity and potentially other fragments contained in that
       * activity.
       * &lt;p&gt;
       * See the Android Training lesson &lt;a href=
       * "http://developer.android.com/training/basics/fragments/communicating.html"
       * &gt;Communicating with Other Fragments&lt;/a&gt; for more information.
       */
      public interface OnFragmentInteractionListener {
          // TODO: Update argument type and invoice_number
          void onFragmentInteraction(Uri uri);
      }
  }
  </code></pre>