Memory Usage - Activities vs TabHost

luthepa1

Member
Licensed User
Hi,

Developing an app to work with database and want multiple screen views for displaying different sections of database. I was going to use a tabhost view with 5 tabs with each tab to load, display, save data for different table in db. But if say tab1 is working with data loaded from one table of database and then I move onto the 2nd tab which will then load another table of data, will the first tab view memory be freed? Or would the eventual result be my app loading and holding data in all 5 tabviews of different database tables?

I ask because if its a case of eventually all 4 tabs holding data and taking up precious RAM then maybe I should not use tabhost but rather button panel to load 5 different activities as when activities are closed all views are released, thus with only one activity open at one time then only one table of database is accessed and therefore the overall app uses less RAM.

Is my thinking correct? multiple activities is more RAM efficient?

Thanks.
 

luthepa1

Member
Licensed User
Sorry. Forget my references to databases. I know its up to me to manage the database, close it, etc.

But more to the point. Switching between different tabs of tabhost. Will the views of the previous tab be released when moving to a new tab?
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
No the other tabs won't have their views released.

I'm not sure about the ram efficiency of tabhosts vs activities.

regards, Ricky
 
Upvote 0

warwound

Expert
Licensed User
I think a lot depends on the complexity of the Views on each tabs.

Some Views are lightweight and use little memory, some Views use more memory - a WebView for example uses far more memory than a Label.

A TabHost itself is not a lightweight View.

What Views are you using on each of the tabs?

Martin.
 
Upvote 0
Top