Tab Layout with Different Fragments – Android Studio Tutorial



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:

Facebook:

Instagram:

Twitter:

Blog:

Nguồn: https://svabc.org/

Xem thêm bài viết khác: https://svabc.org/cong-nghe/

50 Comments

  • Coding inflow I am following you since I have started the Android development journey your videos helped me a lot in my projects, keep it up and I will also recommend to other developer like me to watch your videos 🙂

    SoftCoding
    Posted July 12, 2020
  • please start every sample code as empty activity

    Van Thuan Luong
    Posted July 12, 2020
  • Hey, Your videos are really helpful. Can you help me with how to create a fragment directly with empty fragment and invoke them from Main activity? This will really be helpful. Thanks!

    Sapthagiri Manivannan
    Posted July 12, 2020
  • Great

    Alee Shahbaz
    Posted July 12, 2020
  • Respect sir ,make a video on proper login page with data base

    Rajesh bera
    Posted July 12, 2020
  • so helpful ♥

    Elika
    Posted July 12, 2020
  • I've actually looked for an example of how to use this layout everywhere even on the Android Studio documentation and I haven't found it and i was about to give up, you sir have my respect

    Mohammad Ghazal
    Posted July 12, 2020
  • which version do you use?

    Şule Tombul
    Posted July 12, 2020
  • Such a nice and quality tutorial. Keep it up .

    Partha Prateem Patra
    Posted July 12, 2020
  • Following your videos since forever to learn and develop new projects!!!!
    Thank you.

    Debjit Chattopadhyay
    Posted July 12, 2020
  • for some reason, I know your voice very well. I think you did a video that really helped me in the past…

    Tekena Tariah
    Posted July 12, 2020
  • How could I set it to horizontal scrollview if I have multiple fragments..?? Is it automatically set nor u need to set it

    Kim Layao
    Posted July 12, 2020
  • Thanks a lot bro
    but when i'm trying to insert ImageView in Fragment its always never display it

    هشام حمدى
    Posted July 12, 2020
  • THUMBS UP for mentioning Fragment.newInstance(), that's exactly what I need for instantiating new fragment with different args.

    Junjie Chen
    Posted July 12, 2020
  • sir please help me i got error : can not resolve the symbol v7

    Vellaiyan. M
    Posted July 12, 2020
  • I'm really confused the newer update looks alot differrent :S

    DeadManRising
    Posted July 12, 2020
  • https://www.youtube.com/watch?v=TY-2Cx4IW9A
    to open Activity from the fragment using the button

    Raj Ramakant Gupta
    Posted July 12, 2020
  • Great….. thank you so much 🙂

    Chemical 2015
    Posted July 12, 2020
  • Hello, I'm new to android studio and your tutorial are realy helpful, thanks for the help for navigation drawer !

    Is that possible to implement tablayout with fragments in a fragment itself ?

    Any hint to do that?

    Etienne Pin-Claret
    Posted July 12, 2020
  • Hey,
    When I start the app, in fragment 1 the fragment 2's onCreate() method invokes and in fragment 2 the fragment 3's onCreate() method invokes. Why is this happening?

    Kaushik Sharma
    Posted July 12, 2020
  • its 2020 and you still saving lives, lemme know if you ever come to botswana i'l buy you a drink. God Bless your gran children

    nonofo kokotetso
    Posted July 12, 2020
  • I am on my degree final project and you just save me a lot of empty hours.
    I love you.

    Ricard Barnes
    Posted July 12, 2020
  • Hello my friend . How can we add Lisview containing headings of Sitrin in each tab?Please

    سمبل البصري
    Posted July 12, 2020
  • Hi,
    I'm trying to make more tabs but I don't know how to. Could you please help?

    jobel Rahman
    Posted July 12, 2020
  • thnks

    Gonzalo Bigo
    Posted July 12, 2020
  • We can add more than 10 tabs?? o just 3

    Copy Top
    Posted July 12, 2020
  • 5:00

    Rajat Sharma
    Posted July 12, 2020
  • can you show how to create a webview with fragments. But how to create a fragment when a user clicks on button.
    Thanks Florian

    Flawless Saturation
    Posted July 12, 2020
  • 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

    regragui soulaimane
    Posted July 12, 2020
  • When I add more than 3 tabs they overlap. How can i solve this issue??

    Yusra Fatima
    Posted July 12, 2020
  • what i have to do if i want to go one activity to another by swiping?

    Md Yousuf
    Posted July 12, 2020
  • 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

    Venkatesh Chowdary
    Posted July 12, 2020
  • How to transfer data between tabs?

    Günay Yüksek
    Posted July 12, 2020
  • How to add menu??? In my Tabbed Activity menu is missing. Please help

    Yunis Rasulzade
    Posted July 12, 2020
  • thank so much you are talented in teaching

    Samuel Tesfay
    Posted July 12, 2020
  • Similar to AM Rayhan I also can't find Navigation Style

    Waqas Ahmed
    Posted July 12, 2020
  • 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

    Ebtsam Zoser
    Posted July 12, 2020
  • 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.

    clamum
    Posted July 12, 2020
  • 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

    ꧁TeaCup꧂
    Posted July 12, 2020
  • hello sir can you help me to how can i create Dynamic tabs from firebase database like category

    Adnan Saleh
    Posted July 12, 2020
  • thx this was helpful

    Jacob SB
    Posted July 12, 2020
  • I couldnt use a motion layout in frag1.. how can I do that? I want to use different animations in each tabs

    siket run
    Posted July 12, 2020
  • Can I play different sounds for every swipe in framgents?

    Tech GeekBoy
    Posted July 12, 2020
  • The code is not complete at the link can you please share the complete code

    Mohammad Kassir
    Posted July 12, 2020
  • This was so helpful and useful. Thank you so much. You are best android tutor! ^_^

    Бямбасүрэн Ганболд
    Posted July 12, 2020
  • 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!

    ABHMughal
    Posted July 12, 2020
  • Hi,
    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

    Please…..?

    Coding Birds Online
    Posted July 12, 2020
  • Ok… now I zi.
    Thanks

    Paweł Tarsała
    Posted July 12, 2020
  • Can you create custom tab like uc browser and chrome …..?????

    Arya The Great Engineer
    Posted July 12, 2020
  • How to implement Single tab two fragment in Android

    Let's Learn Computer Programs
    Posted July 12, 2020

Leave a comment