title: Is it possible to display tabs without using fragments in android 3.0?
body: <p>Is it possible to display tabs without using fragments in android 3.0?I have created actionbar with tabs extending fragments.But without using fragments and by extending activity will i be able to display tabs.I need to achieve that.pls help.I have posted my code also.</p>
  
  <p><strong>Java Code :</strong></p>
  
  <pre><code>public class ActionbarActivity extends Activity {
      ActionBar bar;
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          ActionBar bar = getActionBar();
  
          bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
          ActionBar.Tab tabA = bar.newTab().setText("Home");
          ActionBar.Tab tabB = bar.newTab().setText("Listings");
          ActionBar.Tab tabC = bar.newTab().setText("Remote");
          Fragment fragmentA = new ATab();
          Fragment fragmentB = new BTab();
          Fragment fragmentC = new CTab();
          bar.setDisplayShowHomeEnabled(true);
          tabA.setTabListener(new MyTabsListener(fragmentA));
          tabB.setTabListener(new MyTabsListener(fragmentB));
          tabC.setTabListener(new MyTabsListener(fragmentC));
          bar.addTab(tabA);
          bar.addTab(tabB);
          bar.addTab(tabC);
  
      }
  
      public boolean onCreateOptionsMenu(Menu menu) {
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.option, menu);
  
          return true;
      }
  
      protected class MyTabsListener implements ActionBar.TabListener {
          private Fragment mfragment;
  
          public MyTabsListener(Fragment fragment) {
              this.mfragment = fragment;
  
          }
  
  
          @Override
          public void onTabSelected(Tab tab, FragmentTransaction ft) {
              ft.add(R.id.fragment_place, mfragment, null);
  
          }
  
          @Override
          public void onTabReselected(Tab tab, FragmentTransaction ft) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void onTabUnselected(Tab tab, FragmentTransaction ft) {
              // TODO Auto-generated method stub
              ft.remove(mfragment);
  
          }
      }
  }
  
  
  
  
  public class ATab  extends Fragment 
  
      {
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState)
      {
      return inflater.inflate(R.layout.atab, container, false);
      }
      }
  
  
  
  
  public class BTab extends Fragment  
  
  {
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
  Bundle savedInstanceState)
  {
  return inflater.inflate(R.layout.btab, container, false);
  }
  }
  
  
  
  
  
  public class CTab extends Fragment 
  
  {
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
  Bundle savedInstanceState)
  {
  return inflater.inflate(R.layout.ctab, container, false);
  }
  }
  </code></pre>
  
  <p><strong>xml.code :</strong> </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      &gt;
  
      &lt;LinearLayout android:layout_height="wrap_content"
  android:layout_width="match_parent"
  android:id="@+id/fragment_place"&gt;&lt;/LinearLayout&gt;    
  
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>