You have to create a class extending the ActivityGroup and set that as
content for the tab.

tabHost.addTab(tabHost.newTabSpec("Tab1")
                .setIndicator("Tab1")
                .setContent(new Intent(this, TabActivityGroup.class)
                 .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));



class TabActivityGroup extends ActivityGroup{


@Override
protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

      // Some code

      View view = getLocalActivityManager()
                                .startActivity("ReferenceName", new
Intent(this,YourActivity.class)
                                .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
                                .getDecorView();
       this.setContentView(view);
}
}

The above code would let you add an activity to the activity group and set
it as content to the tab. If you have to change to another activity, with
the reference to the LocalActivityManager object, start another activity.

Hope this helps.


On Tue, Apr 21, 2009 at 1:34 PM, benjamin.lehej...@googlemail.com <
benjamin.lehej...@googlemail.com> wrote:

>
> yes i think you got it.. How does that work for example plz?
>
> On 21 Apr., 09:19, Android Users <androidmai...@gmail.com> wrote:
> > Sorry that i am re-phrasing your questions. Just want to confirm with my
> > understanding, running more than one activity (changing from one activity
> to
> > another) within a tab. If that is the case then you will have to define
> an
> > ActivityGroup set it as the content for your tab.
> >
> > if thats what you really meant then do reply so that i can help you on
> the
> > same.
> >
> > On Tue, Apr 21, 2009 at 11:35 AM, benjamin.lehej...@googlemail.com <
> >
> >
> >
> > benjamin.lehej...@googlemail.com> wrote:
> >
> > > hi,
> >
> > > oh sorry but i know the api-demo and for one activity firing up an
> > > intent worked well but i really mean a android-task! So a few
> > > activities where sequential launched and  i would like to see all the
> > > content views from these activities in the tab.
> >
> > > On 21 Apr., 07:54, Android Users <androidmai...@gmail.com> wrote:
> > > > You mean running an activity within a tab????
> >
> > > > If so, yes you can.
> >
> > > > Ex:
> >
> > > > tabHost.addTab(tabHost.newTabSpec("Tab 1")
> > > >                 .setIndicator("Tab 1")
> > > >                 .setContent(new Intent(this, Tab1Data.class)
> > > >                  .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
> >
> > > > .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) ------ use this if u need
> the
> > > > activity to be refreshed everytime its opened.
> >
> > > > On Tue, Apr 21, 2009 at 11:02 AM, Benny <
> > > benjamin.lehej...@googlemail.com>wrote:
> >
> > > > > Hi everybody,
> >
> > > > > is it possible to load a whole android-task in a single tab from
> the
> > > > > TabHost widget?
> >
>

--~--~---------~--~----~------------~-------~--~----~
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