title: How to get the position of cardView item in recyclerView?
body: <p>I created one adapter class for recycler for populating cardview layout in recyclerview. It is working fine, but when i click cardView item in recyclerview i need to get position of that cardview item , based on that i need to write a Intent activity. Along with how to delete that cardview item when i swipe left to right.
  <code>MyAdapter</code> class.</p>
  
  <pre><code>public class MyAdapter extends RecyclerView.Adapter&lt;MyAdapter.ViewHolder&gt; {
      private NavigationItem[] navigationItem;
      private Context mContext;
  
      public MyAdapter(NavigationItem[] navigationItem) {
          this.navigationItem = navigationItem;
      }
  
      @Override
      public MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View itemLayoutView = LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.navigation_row_cardview, null);
          ViewHolder viewHolder = new ViewHolder(itemLayoutView);
          return viewHolder;
      }
  
      @Override
      public void onBindViewHolder(MyAdapter.ViewHolder holder, int position) {
          holder.txtViewTitle.setText(navigationItem[position].getTitle());
      }
  
      @Override
      public int getItemCount() {
          return navigationItem.length;
      }
  
      public class ViewHolder extends RecyclerView.ViewHolder {
          @InjectView(R.id.hambergerRecyclerView)
          public RelativeLayout recyclerView;
          public TextView txtViewTitle;
  
          public ViewHolder(final View itemLayoutView) {
              super(itemLayoutView);
              ButterKnife.inject(this, itemLayoutView);
              txtViewTitle = (TextView) itemLayoutView.findViewById(R.id.navigationItemOptionName);
  
              itemLayoutView.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View view) {
                      // int itemPosition = RecyclerView.getChildPosition(view);
                      int itemPosition = recyclerView.getChildAdapterPosition(view);
                      String item = navigationItem.get(itemPosition);
                      Toast.makeText(mContext, item, Toast.LENGTH_LONG).show();
                  }
              });
          }
      }
  }
  </code></pre>