tags:

views:

86

answers:

1

Hello,

In my current project I have a full screen TabActivity. Each tab content is handled by two instances of same ListActivity. Now, I put an extra int in intent to know which data should be displayed. So in onCreate method of my ListActivity, I check the int in extra and I build my query to obtain a SQLLiteCursor.

I would like to dynamycally give to this two instances of ListActivity the list of item that should be displayed.

I do not know what is the best way to do this. Any idea ?

Regards,

+3  A: 

Each tab content is handled by two instances of same ListActivity.

Why not just use ListViews as the contents of the tabs? Why make your job so much harder by wrapping those ListViews each in a ListActivity, then having to work around the fact that you wrapped each in a ListActivity?

Get rid of the ListActivity classes. Put two ListViews as the contents of your tabs. Hand the Adapters to those ListViews in your TabActivity (or regular activity that is using a TabHost).

CommonsWare
I'll try it. Thanks for the idea. Actually, I just started Androïd development I did not know the godd practices.Regards
Quentin
Sorry, it's just that I keep seeing developers use the activities-as-tabs pattern, and it drives me batty.
CommonsWare
So it works !I use two SimpleCursorAdapters for my lists and I can change list content with the changeCursor method.Thank you.
Quentin