package com.joshclemm.android.tabs;
/*
    Copyright (c) 2010 Josh Clemm
    Copyright 2012 Lawrence D'Oliveiro <ldo@geek-central.gen.nz>

    Licensed under the Apache License, Version 2.0 (the "License"); you may not
    use this file except in compliance with the License. You may obtain a copy of
    the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    License for the specific language governing permissions and limitations under
    the License.
*/

import android.view.View;
import android.widget.TabHost;
import android.widget.TextView;

public class CustomTabActivity extends android.app.Activity
  {

    private TabHost mTabHost;

    @Override
    public void onCreate
      (
        android.os.Bundle savedInstanceState
      )
      {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mTabHost = (TabHost)findViewById(R.id.mytabhost);
        mTabHost.setup();
        mTabHost.getTabWidget().setDividerDrawable(R.drawable.tab_divider);

        for (String TabName : new String[]{"Tab 1", "Tab 2", "Tab 3"})
          {
            final View contentview = new TextView(this); /* should really put something into this for show */
            View indicatorview =
                android.view.LayoutInflater.from(this).inflate(R.layout.tabs_bg, null);
            ((TextView)indicatorview.findViewById(R.id.tabsText)).setText(TabName);
            mTabHost.addTab
              (
                mTabHost.newTabSpec(TabName)
                    .setIndicator(indicatorview)
                    .setContent
                      (
                        new android.widget.TabHost.TabContentFactory()
                          {
                            public View createTabContent(String tag)
                              {
                                return contentview;
                              } /*createTabContent*/
                          } /*TabContentFactory*/
                      )
              );
          } /*for*/
      } /*onCreate*/
  } /*CustomTabActivity*/

@@ -1243,71 +1243,761 @@
     
-for (String TabName : new String%5B%5D%7B%22Tab 1%22, %22Tab 2%22, %22Tab 3%22%7D)%0A
+  %7B%0A            class TabDef%0A              %7B%0A                public final String Indicator, Content;%0A                public TabDef%0A                  (%0A                    String Indicator,%0A                    String Content%0A                  )%0A                  %7B%0A                    this.Indicator = Indicator;%0A                    this.Content = Content;%0A                  %7D /*TabDef*/%0A              %7D /*TabDef*/;%0A            for%0A              (%0A                TabDef ThisTab :%0A                    new TabDef%5B%5D%0A                      %7B%0A                        new TabDef(%22Tab 1%22, %22Content 1%22),%0A                        new TabDef(%22Tab 2%22, %22Content 2%22),%0A                        new TabDef(%22Tab 3%22, %22Content 3%22),%0A                      %7D%0A              )%0A  
     
@@ -1994,34 +1994,40 @@
   )%0A            
-%7B%0A
+  %7B%0A    
             fina
@@ -2070,62 +2070,79 @@
 is);
- /* should really put something into this for show */%0A
+%0A                ((TextView)contentview).setText(ThisTab.Content);%0A    
     
@@ -2178,32 +2178,36 @@
                 
+  
+  
 android.view.Lay
@@ -2266,32 +2266,36 @@
 l);%0A            
+    
 ((TextView)indic
@@ -2345,17 +2345,31 @@
 xt(T
-abName);%0A
+hisTab.Indicator);%0A    
     
@@ -2398,34 +2398,42 @@
 b%0A              
+   
+ 
 (%0A
+    
                 
@@ -2457,16 +2457,30 @@
 ec(T
-abName)%0A
+hisTab.Indicator)%0A    
     
@@ -2540,24 +2540,28 @@
             
+   
+ 
 .setContent%0A
@@ -2574,34 +2574,42 @@
                 
-(%0A
+    (%0A    
                 
@@ -2681,34 +2681,40 @@
                 
-%7B%0A
+    %7B%0A  
                 
@@ -2721,24 +2721,26 @@
             
+  
 public View 
@@ -2790,34 +2790,42 @@
                 
-%7B%0A
+    %7B%0A    
                 
@@ -2860,16 +2860,20 @@
 ntview;%0A
+    
         
@@ -2939,24 +2939,28 @@
             
+    
 %7D /*TabConte
@@ -2985,34 +2985,42 @@
                 
-)%0A
+    )%0A    
               );
@@ -3026,24 +3026,28 @@
 ;%0A          
+  
+  
 %7D /*for*/%0A  
@@ -3044,16 +3044,28 @@
 /*for*/%0A
+          %7D%0A
       %7D 

add some content to the tabs