Android Tabs with Fragments

Evelina Vrabie

Dedicated coder, occasional blogger, hackathon goer and friendly team mate.

You may also read...

195 Responses

  1. The major complaint about the Pass/Fail system for college courses is that many educators feel it leads to the student not applying himself or herself to the work as diligently as they might otherwise do. Some studies do show a drop in student interest when the competitive grading system is removed. Students on the other hand feel the Pass/Fail system allows them to concentrate on favored topics while not becoming academically depressed in subjects they do not excel in. Also, a Pass/Fail ranking is not an option for college courses that are required or needed to fulfill the requirements for a Major.

  2. flagg327 says:

    Thank you so much! it works just fine. Great job. Thank you.

  3. hvac resumes says:

    I used to be suggested this blog by my cousin. I am not sure whether this submit is written via
    him as no one else recognize such detailed approximately my trouble.

    You’re amazing! Thanks!

  4. This is the perfect site for anybody who wants to find out about this topic.
    You understand so much its almost hard to argue with you (not that I really would want to…HaHa).
    You certainly put a new spin on a subject that has been discussed for
    a long time. Excellent stuff, just excellent!

  5. this might be referred to as vaping and it is returning
    to becoming a cultural phenomenon plus a difficult
    general public ailment.

  6. aditya says:

    what is and R.layout.list_item….its not working

  7. I’m amazed, I must say. Rarely do I come across a blog that’s both
    equally educative and amusing, and let me tell you, you have hit
    the nail on the head. The problem is an issue that too few people are speaking intelligently
    about. Now i’m very happy I found this in my search for something regarding this.

  8. Hi, I desire to subscribe for this web site to get newest
    updates, thus where can i do it please assist.

    Also visit my web-site – Debrah C. Cardone

  9. Hi my friend! I wish to say that this post is awesome, nice written and
    come with almost all important infos. I’d like to look
    extra posts like this .

    My site: casino night rental nj

  10. Thanks in favor of sharing such a pleasant thinking, article is good, thats why i have read it entirely

    Review my weblog integrity cleaning

  11. Thanks for sharing your info. I really appreciate your efforts and I am
    waiting for your further write ups thanks once again.

    Look at my web blog: public adjuster philadelphia

  12. Hello there! This post couldn’t be written any better!
    Reading this post reminds me of my good old room mate!
    He always kept talking about this. I will forward this article to him.
    Fairly certain he will have a good read. Thank you for sharing!

    In order to get more information on the topic matter take a look at this web site with regard
    to aroma rice cooker reviews.

  13. Hello there, You have done an incredible job. I’ll certainly digg it and personally suggest to my friends.

    I’m sure they’ll be benefited from this site.

  14. Have you ever considered about adding a little bit
    more than just your articles? I mean, what you say is valuable and everything.

    But think of if you added some great photos or video clips to
    give your posts more, “pop”! Your content is excellent but with pics and videos,
    this blog could definitely be one of the greatest in its niche.
    Great blog!

    my blog … how to lose 50 pounds in 3 months

  15. Thanks for some other excellent article. Where else may just anybody get
    that kind of info in such a perfect approach of
    writing? I have a presentation next week, and I am on the search for
    such information.

    my website – Gideon Shalwick

  16. I feel this is one of the such a lot vital information for me.
    And i am glad studying your article. However should commentary on few general
    issues, The website style is perfect, the articles is in reality nice : D.
    Good job, cheers

    My page – replacement garage door opener remote

  17. Greate post. Keep posting such kind of information on your site.
    Im really impressed by it.
    Hey there, You’ve performed an incredible job. I’ll definitely digg it and
    in my opinion recommend to my friends. I am sure they will be benefited from this website.

    Check out my homepage alcohol rehabs

  18. Hi there! This is my 1st comment here so I just wanted to
    give a quick shout out and tell you I really enjoy reading your blog posts.
    Can you recommend any other blogs/websites/forums that deal
    with the same subjects? Thanks a ton!

    Review my homepage top things to do on long island

  19. My partner and I stumbled over here coming from a different page and thought I may as well check things out.
    I like what I see so now i’m following you.
    Look forward to finding out about your web page yet again.

    Feel free to visit my website; comparatif adsl

  20. Pretty! This has been an extremely wonderful
    post. Thank you for supplying these details.

  21. Nice blog here! Also your website loads up very fast!

    What web host are you using? Can I get your affiliate
    link to your host? I wish my website loaded up as quickly
    as yours lol

  22. If you start them all within the daily use of computer, you’ll
    obtain a slow running computer. In order to build these structures, you will require resources.
    To use this new resource, click on the start key.

  23. Hello to all, the contents existing at this web page are actually awesome for people knowledge, well, keep
    up the good work fellows.

    My weblog: making a Disney vacation magical

  24. I like the helpful info you provide for your articles.
    I will bookmark your weblog and take a look at again right here frequently.

    I am moderately certain I will learn plenty of new stuff right right here!
    Best of luck for the next!

  25. If you desire to take a great deal from this post then you
    have to apply such techniques to your won weblog.

  26. Attractive section of content. I just stumbled upon your weblog and in accession capital to
    assert that I get actually enjoyed account your blog
    posts. Anyway I will be subscribing for your augment
    or even I achievement you get admission to constantly quickly.

    my web page :: challenger garage door opener

  27. We are a bunch of volunteers and starting a brand new scheme in our community.
    Your site provided us with helpful information to work on. You’ve
    done an impressive activity and our entire neighborhood
    will likely be thankful to you.

  28. faster says:

    Hello to every one, the contents present at this
    site are truly amazing for people experience, well, keep up the nice
    work fellows.

  29. Hildegarde says:

    Excellent blog here! Additionally your site so much up fast!
    What web host are you using? Can I am getting your affiliate hyperlink for your host?
    I want my web site loaded up as fast as yours lol

  30. Aw, this was an extremely good post. Taking a few minutes
    and actual effort to produce a superb article… but what can I say… I procrastinate a
    whole lot and never seem to get anything done.

  31. Hello There. I found your blog using msn. This is an extremely well written article.
    I will make sure to bookmark it and return to read more of
    your useful info. Thanks for the post. I’ll certainly comeback.

  32. I will right away take hold of your rss as I caan not too find your
    email subscription hyperlink or e-newsletter
    service. Do you hzve any? Kindly allow me recognize in order that I may subscribe.

    Also visit myy homepage:surfing puerto rico (

  33. A Pattek says:

    Hello my family member! I want to say that this post is
    awesome, great written and include approximately all significant infos.
    I would like to see extra posts like this .

    Here is my web site :: A Pattek

  34. Please let me know if you’re looking for a article author
    for your site. You have some really good posts and I believe I would be a good asset.
    If you ever want to take some of the load off, I’d love to write some content for your blog in exchange
    for a link back to mine. Please blast me an email if
    interested. Kudos!

    Look at my blog post … Torrance dui attorneys

  35. I am really thankful to the holder of this website who has shared
    this enormous piece of writing at at this time.

  36. Eduardo K says:

    Thanks! Nice post!

  37. Howdy! Quick question that’s completely off topic.
    Do you know how to make your site mobile friendly?
    My weblog looks weird when viewing from my apple iphone.
    I’m trying to find a template or plugin that might be able to fix this
    problem. If you have any suggestions, please share.
    Appreciate it!

  38. Pearline says:

    The Premier League has been topped by four teams Arsenal, Blackburn Rovers, Chelsea, and Manchester United since the league’s inception. Born from October 14 to 23 – Libra under the
    influence of Jupiter – born gourmand, sensual people, capable in literature, like ceremonies.
    is a positive energy stone and enhances concentration, persistence,.

  39. That is really attention-grabbing, You’re a very skilled blogger.
    I have joined your rss feed and stay up for in search of
    extra of your magnificent post. Also, I have shared your web site in my
    social networks

    my web page garage door opener repair

  40. Hi my friend! I wish to say that this article is amazing, nice written and come with almost all important infos.
    I would like to peer more posts like this .

    my web site: garage door repair

  41. I have read so many posts regarding the blogger lovers but
    this post is genuinely a fastidious piece of writing, keep
    it up.

    Review my page – garage door repair

  42. My brother suggested I might like this web site.

    He used to be totally right. This put up actually made my day.
    You can not consider simply how a lot time I had
    spent for this information! Thanks!

    Feel free to surf to my web-site – garage door repair

  43. all the time i used to read smaller articles or reviews
    that also clear their motive, and that is also happening
    with this paragraph which I am reading here.

    Here is my site: iphone garage door opener

  44. I really like your blog.. very nice colors & theme.
    Did you create this website yourself or did you hire someone to do it for
    you? Plz reply as I’m looking to create my own blog and would like to find out where u
    got this from. cheers

    Feel free to surf to my page … garage door opener

  45. Do you mind if I quote a few of your posts as long as I provide credit and sources back to your weblog?
    My website is in the exact same area of interest as yours and my users would truly benefit from some of the information you present
    here. Please let me know if this okay with you.
    Thank you!

    Visit my blog; hacking software

  46. Thankfulness to my father who shared with me regarding this webpage, this blog is truly amazing.

    Feel free to surf to my web site homelink garage door opener

  47. This piece of writing will assist the internet viewers for creating new
    blog or even a weblog from start to end.

    My website … garage door repair

  48. Helpful info. Fortunate me I found your website accidentally, and
    I am stunned why this twist of fate did not took place earlier!
    I bookmarked it.

  49. Hi everyone, it’s my first pay a visit at this site, and piece of writing is truly fruitful designed for me, keep up posting
    these articles or reviews.

  50. Thanks for your personal marvelous posting! I definitely enjoyed
    reading it, you are a great author. I will make sure to bookmark
    your blog and will often come back from now on. I want to encourage one to continue your
    great posts, have a nice weekend!

    Feel free to visit my homepage; wendy stevens ft lauderdale

  51. Pick a licensed, bonded and insured service provider for garage door repairs to minimize risks
    encountered during repairs like errors, unprofessional technicians and poor workmanship.
    This type of fencing, sometimes called cyclone fencing, is widely used for security purposes
    as well as for creating playground enclosures, animal pens, and more.
    You may also decide to require the recipient’s signature on the return receipt as evidence that the landlord
    received the notice.

    my web-site … garage door repair Atlanta

  52. Right here is the perfect webpage for anyone who wishes to understand this topic.
    You understand so much its almost tough to argue with you (not
    that I really will need to…HaHa). You certainly put a new spin on a topic
    which has been written about for ages. Wonderful stuff, just great!

    Review my site – 24 hour emergency ac repair Solebury

  53. I like the valuable information you provide in your articles.
    I’ll bookmark your blog and test once more right here frequently.

    I’m rather certain I’ll learn plenty of new stuff right
    right here! Best of luck for the next!

    My site … click for more info

  54. Heya are using WordPress for your site platform? I’m new to the
    blog world but I’m trying to get started and create my own.
    Do you need any html coding knowledge to make your
    own blog? Any help would be really appreciated!

    My blog :: contractor surety bonds

  55. I do not even know how I stopped up right here, however I believed
    this put up used to be good. I do not understand who you
    are but definitely you’re going to a famous blogger for those who are not already.

    my weblog back pain relief mesa az

  56. It’s amazing to pay a quick visit this website and reading the views of all friends regarding
    this post, while I am also keen of getting experience.

    My blog post :: wayne dalton garage door opener

  57. What’s Happening i am new to this, I stumbled upon this I
    have found It positively helpful and it has helped me out loads.
    I’m hoping to give a contribution & help different users like its
    aided me. Good job.

    my web site :: replace garage door opener

  58. excellent submit, very informative. I wonder why the opposite specialists of
    this sector don’t understand this. You must continue your writing.
    I’m sure, you’ve a huge readers’ base already!

    Here is my blog post; garage door repair

  59. Great post. I was checking continuously this blog and I am impressed!
    Extremely helpful information specifically the last part :
    ) I care for such info much. I was seeking this particular information for a very long time.
    Thank you and good luck.

  60. I pay a visit day-to-day a few web sites and information sites to
    read articles, except this blog provides quality based content.

    Feel free to surf to my weblog … genie intellicode garage door opener

  61. Hello everybody, here every one is sharing these kinds of familiarity, therefore it’s fastidious to read this website, and I used to pay a visit this website everyday.

    Look at my web blog :: garage door repair

  62. Wow that was strange. I just wrote an incredibly long comment but after I clicked submit my comment didn’t appear.
    Grrrr… well I’m not writing all that over again. Anyways, just wanted
    to say great blog!

    Check out my page … wireless garage door opener

  63. I do accept as true with all of the ideas you’ve presented in your post.

    They are really convincing and will certainly work.
    Still, the posts are very brief for beginners.
    May you please extend them a bit from subsequent time? Thank you for the post.

    Feel free to visit my web page: linear garage door opener

  64. Heya i’m for the first time here. I found this board and I
    find It really useful & it helped me out much. I hope
    to give something back and aid others like you aided me.

    my website – linear remote garage door opener

  65. I think the admin of this site is actually working hard for his web page, since here every
    stuff is quality based information.

    My web site – chamberlain garage door opener troubleshooting

  66. Link exchange is nothing else however it is simply placing the other person’s website link on your page at suitable
    place and other person will also do similar in favor
    of you.

    Here is my web blog – stanley garage door opener

  67. Hey there! This is my first visit to your blog! We are
    a group of volunteers and starting a new initiative in a community in the
    same niche. Your blog provided us beneficial information to work on. You have done a wonderful job!

    Visit my web page … garage door repair

  68. Magnificent beat ! I wish to apprentice even as you amend your site,
    how could i subscribe for a weblog web site? The account helped me a appropriate deal.
    I were a little bit acquainted of this your broadcast
    provided bright transparent concept

    My page … how to fix garage door opener

  69. Appreciate this post. Will try it out.

    Feel free to visit my page garage door repair

  70. That is a great tip particularly to those new to the blogosphere.
    Simple but very accurate information… Thanks for sharing this one.
    A must read article!

    Visit my homepage … stanley garage door opener remote

  71. You could certainly see your skills in the work you write.
    The sector hopes for more passionate writers like you who
    aren’t afraid to mention how they believe.
    At all times follow your heart.

    Here is my homepage … garage door repair

  72. I’m truly enjoying the design and layout of your website.
    It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create
    your theme? Outstanding work!

    Feel free to visit my weblog outflank dui attorney in orange county

  73. I’ve been surfing on-line more than 3 hours lately, but I by no means
    discovered any attention-grabbing article like yours. It is lovely worth enough for
    me. Personally, if all web owners and bloggers made just right content as you did, the net shall be
    much more helpful than ever before.

    Here is my blog post :: Pest Management Winnipeg MB

  74. Hey there! Do you know if they make any plugins to safeguard against hackers?
    I’m kinda paranoid about losing everything I’ve worked hard on. Any tips?

    Look at my blog post … liftmaster garage door opener manual

  75. This is really fascinating, You’re an excessively skilled blogger.

    I’ve joined your rss feed and look ahead to in quest of extra of your excellent
    post. Also, I’ve shared your site in my social networks

    Here is my page :: Safe Pest Control Halifax NS

  76. hello there and thank you for your information – I’ve
    certainly picked up something new from right here.
    I did however expertise several technical issues using this web site,
    as I experienced to reload the site many times previous to I could
    get it to load correctly. I had been wondering if your web hosting is OK?
    Not that I’m complaining, but slow loading instances times will
    often affect your placement in google and could damage
    your high quality score if ads and marketing with Adwords.
    Well I’m adding this RSS to my e-mail and could look out for a lot more of your respective fascinating
    content. Make sure you update this again soon.

  77. This info is invaluable. Where can I find out more?

    Check out my page … hosted phone system New York City

  78. Alberto says:

    When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several
    emails with the same comment. Is there any way you can remove
    people from that service? Thank you!

  79. Howdy I am so excited I found your website, I really found you by accident, while I was browsing
    on Aol for something else, Nonetheless I am here now
    and would just like to say thanks for a fantastic post and a all round
    exciting blog (I also love the theme/design), I don’t have time to browse it
    all at the moment but I have bookmarked it
    and also added in your RSS feeds, so when I have time I will be back to read a
    lot more, Please do keep up the great job.

    Feel free to visit my webpage – Bed Bugs Pest Control Courtenay

  80. Quality articles is the key to invite the viewers to pay a visit the web page,
    that’s what this web site is providing.

    Feel free to surf to my webpage: Bed Bugs Exterminators Victoria

  81. title says:

    I read this article completely about the resemblance of
    latest and previous technologies, it’s remarkable article.

    my web-site … title

  82. I’m gone to convey my little brother, that he should also visit this web
    site on regular basis to take updated from most up-to-date news update.

  83. Sandy says:

    hello there and thank you for your information – I’ve definitely picked up anything
    new from right here. I did however expertise some technical issues
    using this website, since I experienced to reload the website
    many times previous to I could get it to load correctly.
    I had been wondering if your web host is OK?
    Not that I’m complaining, but slow loading instances times will very
    frequently affect your placement in google and can damage your high
    quality score if advertising and marketing with Adwords.

    Well I’m adding this RSS to my email and can look out for much more of your respective interesting content.

    Ensure that you update this again very soon.

  84. Bernard says:

    Good replies in return of this query with genuine arguments
    and telling all about that.

    Take a look at my homepage – (Bernard)

  85. Asking questions are actually good thing if you are not understanding anything entirely, but this paragraph provides good understanding even.

  86. Shikha Jha says:

    Thanks for the code. I need some help, i want to ask how to spread out the tabs to take the width of whole screen.Please help me.What kind of code i need to add in it. Please help me. Please reply as early as possible . Thank you.

  87. What i do not realize is actually how you are not really much more well-preferred than you may be right now.
    You’re very intelligent. You recognize therefore significantly
    in relation to this topic, made me for my part believe it from
    so many varied angles. Its like women and men aren’t interested until it’s one thing to do with Woman gaga!

    Your personal stuffs outstanding. At all times take care of
    it up!

    Feel free to visit my web-site: behind the teeth braces Elk Grove

  88. Hello, every time i used to check blog posts here in the early hours in the daylight, because i enjoy to learn more and more.

    My web-site – dental implants cost Elk Grove

  89. You really make it seem so easy with your presentation but I find this
    matter to be actually something which I think I would never understand.
    It seems too complex and extremely broad for me.
    I’m looking forward for your next post, I’ll try to get the hang of it!

    Look into my web-site Raccoon Removal Barrie

  90. Neville says:

    What a data of un-ambiguity and preserveness of precious
    knowledge concerning unpredicted feelings.

    Feel free too surf to my homepage: Android Apps PC [Neville]

  91. Sandy says:

    Excellent beat ! I would like to apprentice while you amend your web site,
    how could i subscribe for a blog web site (Sandy)?

    The account aided me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear idea

  92. make money says:

    Undeniably imagine that which you stated. Your favorite reason appeared to be on the web the simplest
    thing to take note of. I say to you, I certainly get annoyed while people think about worries that they just do not recognize
    about. You controlled to hit the nail upon the top as smartly as outlined out
    the entire thing with no need side effect , folks
    could take a signal. Will probably be again to get more.

    Review my blog post … make money

  93. Awesome website you have here but I was wondering if you knew of any message boards that
    cover the same topics talked about in this article?
    I’d really love to be a part of community where
    I can get suggestions from other knowledgeable individuals that share the same
    interest. If you have any suggestions, please let me know.
    Many thanks!

    my web blog – 24 hour heating and cooling Dothan AL

  94. I think what you wrote was very logical.
    But, think on this, suppose you composed a catchier post title?
    I mean, I don’t wish to tell you how to run your website, but what if you added a post title that grabbed people’s
    attention? I mean Android Tabs with Fragments – Android Magic is kinda vanilla.
    You could peek at Yahoo’s home page and note how they create news headlines to get
    viewers interested. You might try adding a video or a pic or
    two to get readers interested about what you’ve written. Just my opinion, it might make your website a little bit
    more interesting.

    My blog post garage door torsion spring repair Minneapolis MN

  95. You really make it seem so easy with your presentation but I find this matter to be really something which I think I would never understand.
    It seems too complex and very broad for me. I’m looking forward for your next post,
    I’ll try to get the hang of it!

    My site – palm tree removal Birmingham AL

  96. Lelia says:

    The motor is responsible for producing quiet operation while
    driving the blades for air movement. Sometimes there are
    many hidden costs with electrical work, and it is
    easy to get taken for a ride. When picking out the fan, you have to be
    quite watchful.

  97. We stumbled over here coming from a different web page and thought I might check things out.
    I like what I see so now i am following you. Look forward to
    looking at your web page again.

  98. Victorina says:

    Snakes symbolize the eternal revolution of the ages and the succession, dissolution and regeneration of humanity.
    He had the guardsman’s crossbow to his shoulder, aiming a newly loaded bolt across the room.
    Should you’re feeling like you focused your enemy spot on in a shot but still missed, check what arms you are using.

  99. Thanks designed for sharing such a pleasant idea, post is pleasant, thats why i have read it fully

  100. Louisa says:

    I agree with you on many of your original ideas here. You’ve done a great job of
    making this very interesting and clear. Thank you.

    Feel free to visit my web-site

  101. wasim says:

    Confused with the code. you have explained well.
    And how you have used those red and green color for rows ?
    I like the style …

  102. Excellent post. I certainly love this website. Keep writing!

  103. best hack says:

    Everyone loves what you guys are usually up too. This kind of clever work and
    exposure! Keep up the awesome works guys I’ve you guys to my
    own blogroll.

  104. First off I want to say awesome blog! I had a quick question that I’d like
    to ask if you don’t mind. I was interested to find out how you center yourself and clear
    your head before writing. I’ve had trouble clearing my mind in getting my thoughts
    out there. I truly do enjoy writing but it just seems like the first 10
    to 15 minutes are generally wasted just trying to figure out how to begin.
    Any ideas or hints? Thank you!

  105. Willem Ghijsen says:

    Nevermind. I played around with it, and the strings are called from strings.xml. I originally thought it was in the java code:
    public static final String TAB_WORDS = “words”;
    public static final String TAB_NUMBERS = “numbers”;
    but that was incorrect

  106. Willem Ghijsen says:

    I was going through the code, and added an extra tab to experiment. This was successful, however, I cannot seem to find out how/why the tabs start with a capital letter, since the strings passed in are all lowercase. Does anyone know why this happens?

  107. thx for this tutorial !but i have a question !!
    how to hide the titles of the tabs !
    need your help !

  108. These are in fact enormous ideas in on the topic of blogging.

    You have touched some nice factors here. Any way keep up wrinting.

  109. k40s says:

    Thanks a lot for this

  110. John says:

    Very useful. Thanks

  111. bahaha says:

    Can you please post the entire source code? Where is defined, new to android here.

  112. vkhooda says:

    Well Blog post…By the developer for the developers….:)
    Thanks for sharing good tutorial about tab in fragments.

  113. Tom says:

    Brilliant! I was looking for use of custom tabs with fragments because I wanted to use the new Navigation Drawer! Only tutorial I can find that does what I want and I’ve been looking for 3 days! A+++!

  114. Zeus says:

    Can u pls suggest as to how can i add an onclick listener to one of the tab to open a new activity or fragment inside the same tab

  115. Zeus says:

    What if i wanted to start a child activity form one of the tabs then would the tabs still be maintained on that child

    activity as well

  116. Ankit Rohilla says:

    thank you for great tutorial
    Its working

  117. Babar says:

    Hi How can i have tabs at bottom??

  118. Shakir Orakzai says:

    wonderfull very nice

  119. arw357 says:

    Thx . usefull indeed !

  120. rashid says:

    How do i implement this using ListView instead of Creating a list of LinearLayouts? Pls help.

  121. mesi says:

    what is ? pls mention

  122. Jim_Welke says:

    Right on, Evalina! Great code sample; it clarified a lot things I (an Android newbie) was struggling with. Specifically, how to structure the .xml files so that configuration info and selectors work right. I appreciate the clarity in your comments, too. Thanks. Peace.

  123. Authman Apatira says:

    This project (FragmentTabs) crashes when you rotate the device 4x.

  124. dereky says:

    it really helps me a lot,thanks very much

  125. Dusan says:

    OMFG! Does anybody know why i cant set weight atribut on root LinearLayout in tabs.xml. I tryed a lot of thing, but it wont work… I want tabs to spread out to take whole screen…

  126. Dim says:

    Is it simple enough to add each fragment to the backstack such that hitting the back button returns to the previous tab?

  127. nate says:

    If you wanted to make one of the fragments a mapview how would you go about do that?

  128. Everton Barros says:

    Very nice post, I needed to do something similar, only in my case I needed to put tabs in a popup, after picking up a bit, I managed to reach the final solution. Thank you!

  129. rathael says:

    I think you must change “getListView().setAdapter(mAdapter);” by “setListAdapter(mAdapter);”.

  130. jin says:

    Hi, This tutorial really helped me a lot. I want to make a third tab, but unable to code it. Pl help for the same.

  131. CH4:D says:

    Line 106 is wrong. It should just simply be
    if (mPosition < mTotal).

    As it stands, the last element in the array won't show up if you add the "- 1" because it stops one item behind.

  132. Alex says:

    this is crashing on second orientation change

  133. binhbt says:

    Oh man. Thanks a lot. nice example :X:X:X:X:X:X:X:X::-*

  134. zx81 says:

    Hi, Thanx for nice example, saves lot of learning time.

    BTW, what is in newTab() and how can I create a proper XML for that element?

  135. seetha says:

    you are superb dear….

  136. Filip Bulovic says:

    Very nice example, thanks.

  137. mith says:

    Hi. Thanks for the wonderful code and tutorial. I have a question though. How could I make the tabs scrollable as in if I add many tabs , how to make it scrollable horizontally ?

    • mith says:

      A quick google search helped me.. This is how I did

      Hope this helps somebody.

    • evelyne24 says:

      Hey, thanks for the comment. My code has become a bit obsolete because there are other people out there creating compatibility libraries to support all kinds of ICS features, including tabs, tabs + swipe, etc. Best look for Jake Wharton’s libraries (he’s the author of ActionBarSherlock). Check out this library: it probably has everything you want.

      • Thomas Markle says:

        You should add an update at the top of the post, I just found the ABSherlock library and it looks like it’s a great time saver.

  138. nicolas raby says:

    Hi, , does I mean the code requires Android v4 at least ?

  139. kyk says:

    Thanks for posting a working project!

  140. Gladiatornoida says:

    I found it in your code. Thanks!

  141. Gladiatornoida says:

    private TabSpec newTab(String tag, int labelId, int tabContentId) {
    Log.d(TAG, “buildTab(): tag=” + tag);

    View indicator = LayoutInflater.from(getActivity()).inflate(,
    (ViewGroup) mRoot.findViewById(, false);
    ((TextView) indicator.findViewById(;

    TabSpec tabSpec = mTabHost.newTabSpec(tag);
    return tabSpec;

    Can you please give explanation for & indicator.findViewById( From where these ids come?

    • Kyle Beckman says:

      I have the same question…. any help?

      • Nelson says:

        I’m not sure about, but I think you actually mean, but is just the id of a TextView defined in the list_item.xml file. She’s not talking about it in the text, but if you download the tar file with the whole project there you can see that file, which is actually the layout for every single row displayed in the listview.

        • Nico Sordoni says:

 doesn’t appear anywhere, but instead appear, that is the layout used as “background” for the indicators of the tabs. is a TextView inside this layout, used to contain the text of the tab’s indicator.

  142. Tom Karni says:

    This is a greate tutorial, helped me a lot.

  143. samcool says:

    Is there an article only for fragments ? I searched around for lot of tutorials and tried implementing by following them but couldn’t get it working. I am looking for fragment implementation which will work on all the android versions. That will be really helpful. Thank you in advance.

  144. Zerotvt says:


  145. Dada Venki says:

    hi i have read your tutorial its nice but i have a doubt if in any tab if i want to move another screen (same tab) like clicking any of the rows in listview how it can be done any suggestion will be a great help

  146. ye009 says:

    Can you post some code for listFragment with which used customlistAdapter in setAdapter and listfragment loads data from asychTaskLoader, I am having problem with how to refresh the listfragment when data is loaded from asynchTaskLoader. Please help

  147. Vinesh Gaadhe says:

    Ohhh man u rocks… I was looking for this from last 24 hours…thanks a lot man

  148. Cloud Jacker says:

    Thanks! I dont understand what your activity is doing though, why do the individual tabs load the words and numbers so slowly? Is that a fragment feature?

    I need to use tabs to load full layouts. Ie tab 1 loads an activity and tab 2 loads a separate activity! But TabActivity and that entire methodology is deprecated, yet this fragment “replacement” isn’t very intuitive for froyo+

    • Evelina Vrabie says:

      Have you read the code? The words are loaded slowly because I wanted to simulate an operation that takes time, like a network call. If you actually read the code you’ll see there’s a Thread.sleep() that does the trick (there’s a comment that says that as well).

      About the methodology, if you think it’s deprecated then use something else that you see fit. If you find a better way, please share so we can all learn

  149. Abe Froman says:

    When I try running the code you provided I just get a loading icon that never goes away. The done loading string appears in my LogCat but nothing is appearing on the screen. If you have any ideas what I may have done wrong please let me know.

    • Brill Pappin says:

      Run it through the debugger, that’s that it’s for.
      I had to modify it as well for my project, but it works just fine.

      • Tom Karni says:

        I had the same problem when I used it in my project but not when I ran this package. Brill, how did you solve it?

    • U Sargin says:

      i have used android-support-v13 no v4 and i have same problem

      • Tom Karni says:

        I finally solved it with:
        public void onLoadFinished(Loader loader, Void result) {
        //update adapter


        • CH4:D says:

          God, this really solved my issue as well! I’ve been up all night trying to customize this tutorial to suit my needs but even simple label and id adjustments screw this app up.

          I don’t know if this is an android or eclipse bug but i tried tracking the changes little by little and rerunning at each change.

          It appears that if you add one extra tab to the tabs_fragment.xml the whole application gets foobar’d. However, this may not be the exact cause but probably a consequence because the issue is intermittent.

          Sometimes the loading screen shows up even if you undo the changes and uninstall the app. Sometimes it just corrects itself after a few runs.

        • rathael says:

          Try to change “getListView().setAdapter(mAdapter);” by “setListAdapter(mAdapter);”.

  150. Brill Pappin says:

    Here is anther tip. The tab in your example are left aligned.
    if you add the android:layout_weight=”1″ attribute to the root LinierLayout of tabs.xml they will spread out to take up the whole width of the screen.

    Long labels will still cause some tabs to be longer than others, but that would be an issue no matter what you did.

    It was also easy to add an image to the tabs.xml so that you get a more “iphone” like effect.

  151. Brill Pappin says:

    Best example of Tabs with Fragments i’ve seen yet. A simple as can be and the code is clean and obvious.

  152. tabbykitten says:

    Thanks for tips
    tab_1, tab_2 is overhead for tabhost_fragment.xml is overhead, you can use directly

  153. Vinh Bui says:

    Thanks a lot, it’s really useful to me.

  154. peng wang says:

    thanks,it is help me .

  155. Evelina Vrabie says:

    Glad to help

  156. Jalota_arun says:

    Thnx alot…this exact i have been lokking for last 3 days…!!gr8 post thnk u!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>