title: CardViews in ListView: Card clicks not executing click listener
body: <p>I am implementing a ListView of CardViews.
  However, when I click, I can see the card being clicked, but does not execute the listener.
  All the cards are rendered properly and clicking, but not executing the listener function.</p>
  
  <p><strong>Activity.java</strong></p>
  
  <pre><code>final List&lt;String&gt; deviceStringList = new ArrayList&lt;String&gt;();
          deviceStringList.add("Device 1");
          deviceStringList.add("Device 2");
          deviceStringList.add("Device 3");
          deviceStringList.add("Device 4");
  
          String[] deviceStringArray = deviceStringList.toArray(new String[deviceStringList.size()]);
          DevicesListViewAdapter cardListAdapter = new DevicesListViewAdapter(this, deviceStringArray);
          ListView deviceCardsListView = (ListView) findViewById(R.id.deviceCardsListView);
          deviceCardsListView.setAdapter(cardListAdapter);
  
          final List&lt;String&gt; finalDeviceList = deviceStringList;
          deviceCardsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
                  Toast toast = Toast.makeText(getApplicationContext(), finalDeviceList.get(position), Toast.LENGTH_LONG);
                  toast.show();
              }
          });
  </code></pre>
  
  <p><strong>ListViewAdapter.java</strong></p>
  
  <pre><code>public class DevicesListViewAdapter extends ArrayAdapter&lt;String&gt;
  {
      private final Activity context;
      private final String[] deviceName;
  
      public DevicesListViewAdapter(@NonNull Activity context, String[] deviceName) {
          super(context, R.layout.device_card_layout, deviceName);
  
          this.context = context;
          this.deviceName = deviceName;
      }
  
      public View getView(int position, View view, ViewGroup parent) {
          LayoutInflater inflater = context.getLayoutInflater();
          View cardView = inflater.inflate(R.layout.device_card_layout, null, true);
  
          Button cardBtn = (Button) cardView.findViewById(R.id.cardButton);
          cardBtn.setText(deviceName[position]);
  
          return cardView;
      }
  }
  </code></pre>
  
  <p><strong>CardView layout</strong></p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:clipToPadding="false"
      android:orientation="vertical"
      android:paddingBottom="@dimen/cardview_default_elevation"
      android:paddingLeft="@dimen/cardview_default_elevation"
      android:paddingRight="@dimen/cardview_default_elevation"
      android:paddingTop="@dimen/cardview_default_elevation"
      android:clickable="true"
      android:focusable="true"
      android:foreground="?android:selectableItemBackground"&gt;
  
  &lt;android.support.v7.widget.CardView
      xmlns:card_view="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="300dp"
      card_view:cardCornerRadius="6dp"
      android:layout_margin="10dp"
      android:clickable="true"
      android:focusable="true"
      android:foreground="?android:selectableItemBackground"&gt;
  
      &lt;android.support.constraint.ConstraintLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_margin="5dp"&gt;
  
          &lt;Button
              android:id="@+id/cardButton"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center_horizontal"
              android:layout_marginBottom="8dp"
              android:layout_marginEnd="8dp"
              android:layout_marginStart="8dp"
              android:layout_marginTop="8dp"
              android:background="@drawable/add_device_btn"
              android:text=""
              app:layout_constraintBottom_toBottomOf="parent"
              app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintStart_toStartOf="parent"
              app:layout_constraintTop_toTopOf="parent" /&gt;
  
      &lt;/android.support.constraint.ConstraintLayout&gt;
  
  
  &lt;/android.support.v7.widget.CardView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>What am I doing wrong? 
  Thank you.</p>