title: OnClickListener and Table Layout
body: <p>I have an Activity with two layouts, both implemented in R.layout.main. The first one is a Relative Layout with the app's main screen, and the other is a Table Layout, holding a kind of Preferences Screen. Normally, the first one is set to visible, and the second one to gone. By clicking a button I make the Relative Layout gone, and the Table Layout visible. 
  And here starts my problem, I wanted to set a OnClickListener to that Table Layout (which is actually an array of buttons). 
  I tried something like: </p>
  
  <pre><code>final TableLayout table = (TableLayout)findViewById(R.id.tab);
      table.setOnClickListener(new OnClickListener(){
          public void onClick(View arg){
               Button clickedButton = (Button)arg;
               String t = (String) clickedButton.getTag();
  
               Toast toast = Toast.makeText(getApplicationContext(),t,Toast.LENGTH_SHORT);
               toast.show();
  
          }
      });
  </code></pre>
  
  <p>Obviously, it doesn't work. 
  I'm quite new to Android programming, and I've been looking for a suitable solution for the whole day without any results. </p>