title: Switch Widget Inside RecyclerView Clickable
body: <p>I'm trying to use a Switch widget inside of a RecyclerView to set the particular component as active or not. How can I detect the switch toggling from the RecyclerView? My current OnItemClickListener intercepts the click on the Switch widget also.</p>
  
  <p>Current Click Listener Code:</p>
  
  <pre><code>mRecyclerView.addOnItemTouchListener(
          new RecyclerItemListener(getApplicationContext(), mRecyclerView,
                  new RecyclerItemListener.RecyclerTouchListener() {
                      public void onClickItem(View v, int position) {
  
                          Toast.makeText(MainActivity.this, "Clicked, position " + position + ". Name: " + GlobalData.totalAlarms.get(position).getAlarmName(), Toast.LENGTH_LONG).show();
  
                      }
                      public void onLongClickItem(View v, int position) {
                      }
                  }));
  }
  </code></pre>
  
  <p>Layout for RecyclerView, including Switch:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="?android:attr/selectableItemBackground"
      android:focusable="true"
      android:clickable="true"&gt;
  
      &lt;TextView
          android:text="TextView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/recycler_mainactivityName"
          android:textAppearance="@style/TextAppearance.AppCompat"
          android:textSize="16sp"
          android:layout_marginTop="15dp"
          android:paddingLeft="20dp" /&gt;
  
      &lt;TextView
          android:text="TextView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below="@+id/recycler_mainactivityTime"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:id="@+id/recycler_mainactivityDays"
          android:paddingLeft="20dp"
          android:textSize="12sp"
          android:layout_marginBottom="5dp" /&gt;
  
      &lt;TextView
          android:text="TextView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/recycler_mainactivityTime"
          android:paddingTop="2dp"
          android:textSize="12sp"
          android:paddingLeft="20dp"
          android:layout_below="@+id/recycler_mainactivityName"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true" /&gt;
  
      &lt;Switch
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/recycler_mainactivityActive"
          android:paddingRight="20dp"
          android:layout_alignBaseline="@+id/recycler_mainactivityTime"
          android:layout_alignBottom="@+id/recycler_mainactivityTime"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:hapticFeedbackEnabled="true" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>When I remove the addOnItemTouchListener, the switches do toggle on click rather than being forced to swype.. Beyond that, how can I detect the touch? The addOnItemClickListener seems to intercept all clicks (unless I do a long click, then the switches toggle).</p>