TabWidget, TabSpec programmatically and refresh data within the tabs from onResume

by David G. » Tue, 20 Oct 2009 19:27:11 GMT


Sponsored Links
 hi there.

I'm a newbie using android sdk.
In my first application, I have a TabWidget which is defined into the
xml. It can contains several tabs, created programmatically. The
number of tabs depends of the data coming from a web service.

I want to reload the data each time the application is displayed. To
do that, I reimplemented the onResume on the activity. A background
task is launched to preform the refresh of the data then, to recreate
the tabs (into a runOnUiThread method).

The problem here is I don't know if I have to recreate the tabs OR to
refresh only the data of the views inside the tabs.

For now, I recreate the tabs but I often got some exceptions and I'm
pretty sure it is the wrong way to do that.
For example, I leave the application with the second tab open, when I
come back, the reload is perform and I got an exception. This
exception is not there if I were on the first tab. I can try to
"clean" the tabs or "remove" the views but I guess is weird to do
that.

So what is the best way to implement tabs and data refresh ?

Thanks a lot!
David
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Font height

Hi All,
I have the TextView in my code, here i want to get the height of the
text. So any one tell me how can i get it.
Thanks in Advance,
Muthu Kumar K.
--~--~---------~--~----~------------~-------~--~----~

2. Paid Apps ETA

Subject says it all.

When will this finally come? "End of January" seems to have passed.
--~--~---------~--~----~------------~-------~--~----~

3. the @hide annotation question

4. Android SDK v1.1 - changes / bug fixes or lack of

5. Playing 3gpp content

6. regarding jni apps

7. How to know the mac address of the device?