In this video we are going to take a look at the Tab Layout and learn how to open a different Fragment on every new page by overriding the getItem method, instead of providing a different instance of the same Fragment all the time.

Example code for this video:

❗ Subscribe to the channel:

⏯ Watch more tutorials:

⭐ Become a channel member for exclusive tutorials and other perks:

㊙ Help translating the videos:

💚 Support the content:

💬 Join the Discord chat:

🎧 Audiobooks and podcasts for programmers:

👶 How to get started with Android development:

📣 Follow Coding in Flow on social media:






Xem Thêm Bài Viết Khác:



  1. Flawless Saturation Reply

    can you show how to create a webview with fragments. But how to create a fragment when a user clicks on button.
    Thanks Florian

  2. regragui soulaimane Reply

    thank you for the tutorials u help soo much , i want to help me please. when i click on item in arraylist i want to open a fragement with tabs and every items got different frag please some help

  3. Yusra Fatima Reply

    When I add more than 3 tabs they overlap. How can i solve this issue??

  4. what i have to do if i want to go one activity to another by swiping?

  5. Venkatesh Chowdary Reply

    I created the fragments in Android app and they are working fine now.!! How can I use the edit text values and other values that I included in the fragments xml.
    For example I have two fragments in my tablayout one is login and other sign up

    Now when the user is in login fragment the details that user enters should be used for external purpose now how can I code for it

  6. Yunis Rasulzade Reply

    How to add menu??? In my Tabbed Activity menu is missing. Please help

  7. Waqas Ahmed Reply

    Similar to AM Rayhan I also can't find Navigation Style

  8. Ebtsam Zoser Reply

    you are awesome but the code is old may you comment with the newer import statement all v4 not working any more please answer me..thanks

  9. Thanks a lot, nice tutorial. I'm trying to learn the current Android development protocol and a SHIT of a lot has changed since I wrote my application years ago, targeting Android v2.3.3.

  10. ꧁TeaCup꧂ Reply

    Hello, can you please help me, I watched your lesson and tried the same, but Android studio had an update, that made all things a sort of another, for example main activity now is almost empty and here is a plenty of another activities. Can you please explain new tabbed activity in one of your videos or right here, I would be really happy if you will

  11. Adnan Saleh Reply

    hello sir can you help me to how can i create Dynamic tabs from firebase database like category

  12. I couldnt use a motion layout in frag1.. how can I do that? I want to use different animations in each tabs

  13. Tech GeekBoy Reply

    Can I play different sounds for every swipe in framgents?

  14. Mohammad Kassir Reply

    The code is not complete at the link can you please share the complete code

  15. Бямбасүрэн Ганболд Reply

    This was so helpful and useful. Thank you so much. You are best android tutor! ^_^

  16. YouTube should make college. I really hate my institute teachers as they just quickly explain PPT slides. This tutorial helped me very well. I was really confused on how to show my own pages in tab activity. Thanks again!

  17. Coding Birds Online Reply

    I have a tab activity with 2 tabs. Both tabs uses fragment, and recylerview list is showing as a used and used list respectively.
    What i need to do is hitting api to make the item unused , i want to get the change in 2nd fragment.
    Simply i want to update the both fragment, item should bw removed from one tab and should appear to 2nd tab. Right now i am refreshing the hole activity.
    But this is not the way. Please help i am working from 5 days


  18. Arya The Great Engineer Reply

    Can you create custom tab like uc browser and chrome …..?????

  19. Let's Learn Computer Programs Reply

    How to implement Single tab two fragment in Android

  20. Wassauf Khalid Reply

    the fragment reloads all data when i go to 1st fragment from 3rd fragment

  21. Waleed Ur Rehman Reply

    sir my application has been stoped and logcat shows no error

  22. can anyone let me know the version of this android studio ?
    please guys i am in a trouble

  23. hello sir, which version of android studio did you use ?
    Mine is the latest version, so many things are updated and how can i download the old version ?

  24. bendeguzgb Reply

    Thank you so much for the help! Your videos are really helpful!
    just a thing, could you please upload the activity_main.xml to your website?

  25. fitria sari darmawan Reply

    i wanna ask for filled the frag1 and etc i using recyclerview,then on frag1 alreday filled with recyclerview but in the frag2 it was empty the recyclerview with data really not working

  26. amona fuad Reply

    When I watching your videos , i insist to don't skip the ad because you deserve to be rich

  27. Alina Zachia Reply

    Doing android programming for last 8 years but did not understand why the fuck we do Fragment fragment = null, why we do it null, can't we do just Fragment fragment;

  28. knowledge House Reply

    I put buttons into frag1 xml but how to set on click listener

  29. i can't find [Action Bar Tabs (with viewpager)] option in navigatin style in android studio 3.3

  30. Nedim Karavdic Reply

    What is the reason that '@string/appbar_scrolling_view_behavior' is an Unresolved class?

  31. Deniz Danaie Reply

    error: cannot find symbol variable section_format
    Can you help out?

  32. hey bro been doing this tutorial in version 2.3.4 now in 3.4 new version has changed the structure on creating the tabbed activity and now the the fragments changed syntax to create new one. can you please update your video, would be helpful 🙂

  33. Your tutorials are the best – always. However, I'm just having a set up issues at present… The navigation style option, where I choose the type of navigation I want, it's not there once I go into res>new>activity>tabbed activity. I've clicked on tabbed activity and the pop up window has popped up for me to create the tabbed activity, but it does not give me an option like the one shown in the video to change the navigation style… As a result, I can't change the activity to Action Bar Tabs (with viewPager)…. Also, in activity main under < the app:layout_behaviour string is red "@string/appbar_scrolling_view_behavior" – this string is red and it says it is an "Unresolved class"… I'm using the latest version of android studio 3.4.. Please can you help, I can't even start this great tutorial with getting this done.. Thank you.

  34. Abhishek Anand Reply

    Very nice way to instruct…..awesome……..thank you.

Write A Comment