So I think I need to do something like this:

////////////////////////////////////////////////////////////////
//In onCreate for class that extends Activity
////////////////////////////////////////////////////////////////

setContentView(R.layout.tabs);

TabHost tabs = (TabHost)this.findViewById(R.id.tabs);
tabs.setup();

TabHost.TabSpec one = tabs.newTabSpec(”one”);
one.setContent(new MyCustomIntent());
one.setIndicator(”Tab1”, this.getResources().getDrawable
(R.drawable.gohome));
tabs.addTab(one);

TabHost.TabSpec two = tabs.newTabSpec(”two”);
two.setContent(new MyCustomIntent());
two.setIndicator(”Tab2”);
tabs.addTab(two);

tabs.setCurrentTab(0);

///////////////////////////////////////////////////////
// Rest of implementation here
///////////////////////////////////////////////////////


Do I have it right?



On Jan 13, 7:56 am, Timothy DeWees <whtdrgn...@gmail.com> wrote:
> Okay, so how do I accomplish what I am looking to do?  I want my UI to
> have 3 to 4 tabs and I want the contents of those tabs to be my
> activities.
>
> On Jan 13, 12:48 am, Sergey Ten <sergeyte...@gmail.com> wrote:
>
>
>
> > Timothy,
>
> > Here onCreate is declared as protected method, not public  in 1.0_r2.
> > For instance, here is how onCreate is implemented by ActivityGroup
> > (which is a parent class forTabActivity):
>
> >     @Override
> >     protected void onCreate(Bundle savedInstanceState) {
> >         super.onCreate(savedInstanceState);
> >         Bundle states = savedInstanceState != null
> >                 ? (Bundle) savedInstanceState.getBundle(STATES_KEY) : null;
> >         mLocalActivityManager.dispatchCreate(states);
> >     }
>
> > Sergey
>
> > Timothy DeWees wrote:
> > > Hello,
>
> > > I'm trying to use aTabActivityclass to tab-ify my application.  I've
> > > found some walkthroughs online but I think they are a little dated.
>
> > > I want to use Activities inside the tab and just re-use the activities
> > > I wrote in the current version.
>
> > > It's telling me that there is no onCreate method so I'm hoping someone
> > > can help me correct the code or give me a substitute.
>
> > > Here is what my code looks like:
>
> > > package [...]
>
> > > import android.app.TabActivity;
> > > import android.content.Intent;
> > > import android.widget.TabHost;
>
> > > public class MyCollection extendsTabActivity{
>
> > >     �...@override
> > >      public void onCreate(Bundle savedInstanceState) {
> > >             super.onCreate(savedInstanceState);
> > >             TabHost host=getTabHost();
>
> > >             host.addTab(host.newTabSpec("one")
> > >                             .setIndicator("Test1")
> > >                             .setContent(new Intent(this,
> > > test.class)));
> > >             host.addTab(host.newTabSpec("two")
> > >                      .setIndicator("Test2")
> > >                      .setContent(new Intent(this, test.class)));
> > >             host.addTab(host.newTabSpec("three")
> > >                            .setIndicator("Test3")
> > >                             .setContent(new Intent(this,
> > > test.class)));
> > >      }
> > > }- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to