title: Android tab clicked
body: <p>I'm trying to apply TABs to my Android layout. How could I identify which tab was clicked?</p>
  
  <p>I have an android tab layout made this way:</p>
  
  <pre><code>package com.truiton.designsupporttabs;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  public class TabFragment2 extends Fragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          return inflater.inflate(R.layout.tab_fragment_2, container, false);
      }
  }
  </code></pre>
  
  <p>With the layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="vertical"&gt;
  
      &lt;TextView
          android:id="@+id/textView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true"
          android:text="Tab 2"
          android:textAppearance="?android:attr/textAppearanceLarge"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I do not know how to identify that a tab like the above example was clicked.</p>