[android-developers] Re: Adding content to a tab view dynamically

2008-08-22 Thread Teo
Thanks for the help. I didn't actually manage it this way, but somehow i saw
the *createTabContent*  function from *TabContentFactory* (which i was
already using actually) is called every time a tab is selected, not just at
its creation. So i make a completely new *LinearLayout* inside the tab and
just return it as the content, being able to do whatever i want in that *
LinearLayout*.

Thanks for the help again.

On Fri, Aug 22, 2008 at 7:20 PM, Josh Guilfoyle <[EMAIL PROTECTED]> wrote:

>
> This seems a bit goofed up to me.  First off, the FrameLayout holding
> your tabs should initially be empty.  the TabHost will manage filling
> it in with the contents of the tab you've selected.
>
> addTouchables is very certainly not what you want.  You want to use
> addView() but make sure that the view you get with getCurrentView is
> what you expect.  Make one tab have a  with android:id="@
> +id/foobarbaz", then check that getCurrentView hands you a view for
> which findViewById(R.id.foobarbaz) succeeds to find your
> LinearLayout.  If not, try getCurrentTabView (there is nod
> ocumentation, so we're just stabbing in the dark here).  The other
> solution is to better abstract the tab content in question and let the
> abstractions manage themselves.  You can do this by separating the
> content of each tab into its own Activity and properly isolate them
> that way.  When you click some button in Activity A, A can manage
> adding views to its layout entirely on its own.
>
> On Aug 21, 11:48 pm, Teo <[EMAIL PROTECTED]> wrote:
> > Ok, great, thanks for the help! Here's the relevant code from the XML:
> >
> > *http://schemas.android.com/apk/res/android
> "
> > android:orientation="vertical"
> > android:layout_width="fill_parent"
> > android:layout_height="fill_parent">
> >  > android:layout_width="fill_parent"
> > android:layout_height="fill_parent">
> >  > android:layout_width="fill_parent"
> > android:layout_height="wrap_content"
> > />
> >  > android:layout_width="fill_parent"
> > android:layout_height="fill_parent"
> > android:paddingTop="62px">
> >  > android:layout_width="fill_parent"
> > android:layout_height="wrap_content"
> > android:text="A semi-random button"
> > />
> > 
> > 
> > *
> >
> > And here's how i tried to add something:
> >
> > *private void addItem(){
> > CheckBox c=new CheckBox(this);
> > ArrayList a=new ArrayList();
> > 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)
> >
>


-- 
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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Annou

[android-developers] Re: Adding content to a tab view dynamically

2008-08-22 Thread Josh Guilfoyle

This seems a bit goofed up to me.  First off, the FrameLayout holding
your tabs should initially be empty.  the TabHost will manage filling
it in with the contents of the tab you've selected.

addTouchables is very certainly not what you want.  You want to use
addView() but make sure that the view you get with getCurrentView is
what you expect.  Make one tab have a  with android:id="@
+id/foobarbaz", then check that getCurrentView hands you a view for
which findViewById(R.id.foobarbaz) succeeds to find your
LinearLayout.  If not, try getCurrentTabView (there is nod
ocumentation, so we're just stabbing in the dark here).  The other
solution is to better abstract the tab content in question and let the
abstractions manage themselves.  You can do this by separating the
content of each tab into its own Activity and properly isolate them
that way.  When you click some button in Activity A, A can manage
adding views to its layout entirely on its own.

On Aug 21, 11:48 pm, Teo <[EMAIL PROTECTED]> wrote:
> Ok, great, thanks for the help! Here's the relevant code from the XML:
>
> *http://schemas.android.com/apk/res/android";
> android:orientation="vertical"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent">
>  android:layout_width="fill_parent"
> android:layout_height="fill_parent">
>  android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> />
>  android:layout_width="fill_parent"
> android:layout_height="fill_parent"
> android:paddingTop="62px">
>  android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> android:text="A semi-random button"
> />
> 
> 
> *
>
> And here's how i tried to add something:
>
> *private void addItem(){
> CheckBox c=new CheckBox(this);
> ArrayList a=new ArrayList();
> 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 android-developers@googlegroups.com
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
-~--~~~~--~~--~--~---



[android-developers] Re: Adding content to a tab view dynamically

2008-08-21 Thread Teo
Ok, great, thanks for the help! Here's the relevant code from the XML:

*http://schemas.android.com/apk/res/android";
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">






*


And here's how i tried to add something:

*private void addItem(){
CheckBox c=new CheckBox(this);
ArrayList a=new ArrayList();
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 android-developers@googlegroups.com
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
-~--~~~~--~~--~--~---



[android-developers] Re: Adding content to a tab view dynamically

2008-08-21 Thread Josh Guilfoyle

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



[android-developers] Re: Adding content to a tab view dynamically

2008-08-21 Thread Josh Guilfoyle

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



[android-developers] Re: Adding content to a tab view dynamically

2008-08-21 Thread dyonis

help,for how to program to google.
- Original Message - 
From: "Teo" <[EMAIL PROTECTED]>
To: "Android Developers" 
Sent: Thursday, August 21, 2008 2:28 PM
Subject: [android-developers] Adding content to a tab view dynamically


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


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