title: OnClickListener for CustomView in RelyclerView
body: <p>I need to set <code>OnClickListener</code> for <code>CutomView</code> (Button), which is in <code>RelyclerView</code>. The problem is that I can catch click on <code>View</code>, but not for <code>CustomView</code>. Any ideas?</p>
  
  <p>I catch click in this way:</p>
  
  <p>My CustomAdapter:</p>
  
  <pre><code>...
      @Override
      public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
          View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.rv, parent, false);
  
          view.setOnClickListener(TestActivity.myOnClickListener);
  
          return new MyViewHolder(view);
      }
  ...
  </code></pre>
  
  <p>And in MainActivity:</p>
  
  <pre><code>...
  private static class MyOnClickListener implements View.OnClickListener {
  
          private final Context context;
  
          private MyOnClickListener(Context context) {
              this.context = context;
          }
  
          @Override
          public void onClick(View v) {
              switch (v.getId()) {
              case R.id.button_map_1: {
              }
                  Toast.makeText(context, "Clicked", Toast.LENGTH_SHORT).show();
                  // And nothing happens
              }
          }
          }
      }
  ...
  </code></pre>