title: How to get tab click in Android?
body: <p>I have created two tabs in my Activity using the below code. This is working perfectly fine. When I click on the first tab I see its contents and the other one shows its content when clicked on it. </p>
  
  <p>How ever I want to set a variable value to true or false based on the Tab selected. But I dont know how to get the tab click for this tab. Can you please help me on this.</p>
  
  <p>The code : </p>
  
  <p>tabHost.setup();</p>
  
  <pre><code>    TabSpec ts = tabHost.newTabSpec("Tab1");
      ts.setIndicator("", getResources().getDrawable(R.drawable.tab1_content));
      ts.setContent(R.id.tab1Layout);
  
  
      tabHost.addTab(ts);
      TabSpec ts1 = tabHost.newTabSpec("Tab2");
      ts1.setIndicator("", getResources().getDrawable(R.drawable.tab2_content));
      ts1.setContent(R.id.tab2Layout);
      tabHost.addTab(ts1);
  </code></pre>