androidlistviewtabslistactivitytabactivity

How would I get a ListView from ListActivty INSIDE a class that extends on TabActivity?


Newbie here, bear with me..

I have a class that extends TabActivity. One of my tabs currently contains one long string composed of some records i got from my sqlite table. Now i'm following a tutorial and the next step is to move away from the string and create something a bit more appropriate for the records, a listView. However it says i'll need to change my class to extend ListActivity but i've already extended TabActivity (not part of the tutorial)and i don't really have the knowledge yet to know where to go from here.

I figure if my tabs content was set with intents to separate classes I wouldn't have a problem but it's important to me that both the tabs and their content are constructed in the same class because i will want to be doing a lot between them later. But maybe there is no way i can avoid creating a separate class? If so could i still point both of my tabs towards the same class? for the same reason as above. But then how would i get them still displaying different content?

I sure there's an obvious solution but i don't have enough programming experience to have a clue what it is, I've been googling a while now but i'm not really sure what to look for so if somebody could point me in the right direction i'd really appreciate it.

Hope I'm talking sense, Here's a link to see the class i'm working on:

Codeviewer.org , my Budget.java


Solution

  • You don't need to have your class extend ListActivity (or TabActivity for that matter) as those classes are just a convenience.

    If you want to show a ListView in a TabActivity, check out this tutorial I wrote.