Now I want to create a TabHost for 3 categories, Pizza, Spaghetti and Snack. Information will be taken form database. Is it possible to access only information of that specific category after the tab is clicked instead of creating it when the activity starts. If it is possible, which way is better.
Asked
Active
Viewed 99 times
0
-
it is kind of unreadable but thanks a lot!!! – Jerryc Apr 21 '15 at 11:02
1 Answers
0
I made something like you over a week ago and after long debugging I realized that the system loads the present tab and the one after it at the same time in case to be ready for swiping anytime you wanna do it (I mean their layouts). So if you place your database logic on the Fragments not on your Activity directly (different database logic on the different tabs), when you load your app, only the first tab database logic will be loaded, but the second tabs layout will be loaded too. Hopefully you could understand what I meant :)

Gabriella Angelova
- 2,985
- 1
- 17
- 30
-
-
I mean to create one activity which extends FragmentActivity and has a ViewPager and a FragmentAdapter, which holds the tabs (the separate fragments). Each fragment has a different layout. You can take a look at this tutorial [https://www.youtube.com/watch?v=Xu2yoIqTsj4 ] It was very useful for me – Gabriella Angelova Apr 21 '15 at 11:15