title: Android | AlertDialog on RecyclerView Item Click
body: <p>I have implemented a RecyclerView. Now I want to display an AlertDialog when an item of RecyclerView is clicked. I tried many ways and none of them worked. 
  Here is my adapter class,</p>
  
  <pre><code>public class SearchResultAdapter extends RecyclerView.Adapter&lt;SearchResultAdapter.MyViewHolder&gt; {
  private List&lt;Searchresult&gt; resultList;
  
  public class MyViewHolder extends RecyclerView.ViewHolder {
      public TextView item1, item2, item3;
  
      public MyViewHolder(View view) {
          super(view);
          item1 = (TextView) view.findViewById(R.id.item1);
          item2 = (TextView) view.findViewById(R.id.item2);
          item3 = (TextView) view.findViewById(R.id.item3);
      }
  }
  
  public SearchResultAdapter(List&lt;Searchresult&gt; resultList) {
      this.resultList = resultList;
  }
  
  @Override
  public MyViewHolder onCreateViewHolder(final ViewGroup parent, int viewType) {
      final View itemView = LayoutInflater.from(parent.getContext())
              .inflate(R.layout.search_result_row, parent, false);
      return new MyViewHolder(itemView);
  }
  
  @Override
  public void onBindViewHolder(final MyViewHolder holder, int position) {
      Searchresult result = resultList.get(position);
      holder.item1.setText(result.getItem1());
      holder.item2.setText(result.getItem2());
      holder.item3.setText(result.getItem3());
  }
  
  @Override
  public int getItemCount() {
      return resultList.size();
  }
  }
  </code></pre>
  
  <p>The AlertDialog should display item1,item2 and item3.Please help me to implement an onClickListener on RecyclerView.</p>