title: Android call multiple buttons with single touch
body: <p>I'm trying to make a really simple touch test for android. I made a simple table layout, with 2 rows and in each row with 2 Views. It fills the screen. I set an onTouchListener that changes the Views background color. The issue is that if I swipe through multiple elements only the first touched elements ontouch event gets deployed. Is there any way to have call a function (change the background color) on all the views I swipe through with a singe touch?</p>
  
  <p>Here is the XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/touch_table"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="#000000"
      android:stretchColumns="*"&gt;
  
      &lt;TableRow android:layout_weight="1"
          android:minHeight="1dp"
          android:minWidth="1dp"&gt;
  
          &lt;View
              android:layout_height="match_parent"
              android:layout_margin="1dp"
              android:background="@color/colorAccent"
              /&gt;
  
          &lt;View
              android:layout_height="match_parent"
              android:layout_margin="1dp"
              android:background="@color/colorAccent"
              /&gt;
  
      &lt;/TableRow&gt;
  
      &lt;TableRow android:layout_weight="1"
          android:minHeight="1dp"
          android:minWidth="1dp"&gt;
  
          &lt;View
              android:layout_height="match_parent"
              android:layout_margin="1dp"
              android:background="@color/colorAccent"
              /&gt;
  
          &lt;View
              android:layout_height="match_parent"
              android:layout_margin="1dp"
              android:background="@color/colorAccent"
              /&gt;
  
      &lt;/TableRow&gt;
  </code></pre>
  
  <p>and the onTouchListener set method:</p>
  
  <pre><code>TableLayout layout = (TableLayout)findViewById(R.id.touch_table);
  for (int i = 0; i &lt; layout.getChildCount(); i++) {
      View v = layout.getChildAt(i);
      if ( v instanceof TableRow) {
          TableRow row = (TableRow)layout.getChildAt(i);
          for ( int j = 0; j &lt; row.getChildCount(); j++ ) {
              View w = row.getChildAt(j);
              //set touch_listener
              w.setOnTouchListener(
                      new View.OnTouchListener() {
                          public boolean onTouch(View v, MotionEvent m) {
                              // Perform tasks here
                              v.setBackgroundColor(Color.GREEN);
                              return true;
                          }
                      }
              );
  
          }
  
      }
  }
  </code></pre>