Ok, great, thanks for the help! Here's the relevant code from the XML:

*<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TabHost android:id="@+id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <TabWidget android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
        />
        <FrameLayout android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:paddingTop="62px">
            <Button android:id="@+id/buttontab"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="A semi-random button"
            />
        </FrameLayout>
    </TabHost>
</LinearLayout>*


And here's how i tried to add something:

*    private void addItem(){
        CheckBox c=new CheckBox(this);
        ArrayList<View> a=new ArrayList<View>();
        a.add(c);
        tabs.getCurrentView().addTouchables(a);
    }*

*tabs* is the TabHost object.

Did i get it wrong with the *addTouchables*? I couldn't find any better
method. Also, instead of *getCurrentView* i tried *getCurrentTabView* and i
also tried a lot of casts applied to children and children of children and i
couldn't get an effect.

(I know the function above is called when it should be - i confirmed it
during debug..)

Thanks,
Teo

On Fri, Aug 22, 2008 at 12:06 AM, Josh Guilfoyle <[EMAIL PROTECTED]> wrote:

>
> Actually my mistake.  getCurrentTabView might just get the view of the
> tab you have selected (not the contents of the tab).  Try
> getCurrentView.  Post sample code if you can't get it working and I
> will explore further.
>
> On Aug 21, 2:04 pm, Josh Guilfoyle <[EMAIL PROTECTED]> wrote:
> > Do you mean to add a new tab or simply dynamically adjust the View
> > hierarchy in a particular tab?  If so, getCurrentTabView will work to
> > do what you need.  Just modify the view hierarchy found there.  Do
> > realize that you are getting the root-level View of the tab, so you
> > must search within that using View#findViewById to locate the actual
> > view you're looking to modify.
> >
> > On Aug 21, 11:28 am, Teo <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> >
> > > i tried debugging quite a bit, but i can't figure it out; is it
> > > possible to add something (buttons, etc.) to a tab? I'm using a
> > > FrameLayout inside a TabWidget inside a TabHost. I tried lots of
> > > things, including adding to TabHost's getCurrentTabView, but i wasn't
> > > lucky.
> >
> > > Any tips?
> >
> > > Thanks,
> > > Teo
> >
>


-- 
Teo (a.k.a. Teodor Filimon, Teominator)
Site - www.teodorfilimon.com | Blog - www.teodorfilimon.blogspot.com
GMT +2 (or PDT +10)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to