Load various actions in tabs

It took quite a while to search for stackoverflow and google and cannot find a guide to correctly explain to me how to implement tabs in my application.

I know that you should not use TabActivity, I also read about the recommendation not to use TabHost (at least this understanding). My interest is not only in changing the content, but also when actively changing tabs.

Example

MainActivity: - Tab1Activity - Tab2Activity - Tab3Activity 

My goal is to create an application supported by a wide range of devices from api 8 to the latest. I am using android-support-v4.jar .

My second goal is to load activity into each tab, because at least two of them consume enough resources, and speed should always prevail.

May help me with guidance or explain the β€œright” way to achieve this.

+4
source share
2 answers

You should use tabs with snippets.

Take a look: http://android.codeandmagic.org/2011/07/android-tabs-with-fragments/

+6
source

Like others, the best way to implement tabs in your application is to use fragments.

You should not use the actions contained in tabactivity that are currently out of date. Even the official documentation suggests using fragments , stating that

New applications should use Snippets instead of this class.

However, if you still feel retro, and you really want to use tabbed actions, you need to use tabhost. A good tutorial can be found here , but again, I highly recommend following the path of the fragment.

+2
source

All Articles