Wow, I hadn't expected replies so quickly !

@MagouyaWare - To answer your question, the OnTabChangedListener code 
rebuilds the listview content.
I have indeed stepped through this to ensure that it does this correctly 
before the first display.

If I call tabhost.setCurrentTab(1) instead of tabhost.setCurrentTab(0), 
then the initial display is correct.

To answer @Mark Murphy (a Commons Guy), when I subsequently click through 
the tabs, the single listview is correctly updated and displayed.
It just doesn't display correctly upon initial display.


On Wednesday, 20 June 2012 17:47:15 UTC+2, MagouyaWare wrote:
>
> Also, what does your OnTabChangedListener code do?
>
> Thanks,
> Justin Anderson
> MagouyaWare Developer
> http://sites.google.com/site/magouyaware
>
>
> On Wed, Jun 20, 2012 at 9:46 AM, Justin Anderson wrote:
>
>> Just out of curiosity, try doing this:
>>
>> *tabhost.setCurrentTab(1);
>> tabhost.setCurrentTab(0);
>> *
>> Does your list show up at that point?
>>
>> Thanks,
>> Justin Anderson
>> MagouyaWare Developer
>> http://sites.google.com/site/magouyaware
>>
>>
>>
>> On Wed, Jun 20, 2012 at 9:41 AM, Simon Giddings  wrote:
>>
>>> I have a TabActivity containing a series of four tabs and a listview.
>>> Each of the tabs reference the same listview.
>>> When the activity is initially displayed, the listview is not displayed.
>>> However, clicking on another tab will display it correctly and clicking 
>>> back on the first tab will also display it correctly.
>>> The content of the listview is changed depending on the selected tab.
>>>
>>> Here is my XML layout :
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <TabHost xmlns:android="http://schemas.android.com/apk/res/android";
>>>     android:id="@android:id/tabhost"
>>>     android:layout_width="match_parent"
>>>     android:layout_height="match_parent" >
>>>     
>>>     <LinearLayout
>>>         android:layout_width="fill_parent"
>>>         android:layout_height="fill_parent"
>>>         android:orientation="vertical" >
>>>         
>>>         <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" >
>>>
>>>             <ListView
>>>                 android:id="@+id/listPoisFound"
>>>                 android:layout_width="match_parent"
>>>                 android:layout_height="wrap_content" >
>>>             </ListView>
>>>             
>>>         </FrameLayout>
>>>     </LinearLayout>
>>>
>>> </TabHost>
>>>
>>> The tabs are initialised like this :
>>>         TabHost tabhost = null;
>>>         TabHost.TabSpec spec = null;
>>>         // get the tabhost
>>>         tabhost = getTabHost();
>>>         
>>>         // create the individual tabs
>>>         spec = tabhost.newTabSpec("first");
>>>         spec.setIndicator("First");
>>>         spec.setContent(R.id.list);
>>>         tabhost.addTab(spec);
>>>         
>>>         spec = tabhost.newTabSpec("second");
>>>         spec.setIndicator("Second");
>>>         spec.setContent(R.id.list);
>>>         tabhost.addTab(spec);
>>>         
>>>         spec = tabhost.newTabSpec("third");
>>>         spec.setIndicator("Third");
>>>         spec.setContent(R.id.list);
>>>         tabhost.addTab(spec);
>>>         
>>>         spec = tabhost.newTabSpec("fourth");
>>>         spec.setIndicator("Fourth");
>>>         spec.setContent(R.id.list);
>>>         tabhost.addTab(spec);
>>>         
>>>         tabhost.setCurrentTab(0);
>>>         
>>>         tabhost.setOnTabChangedListener(this);
>>>
>>> Has anyone come across this problem ?
>>> What is the solution ?
>>>
>>> -- 
>>> 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
>>
>>
>>
>

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