Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Self-Destructing Message Android App Using Fragments for Tabs Modifying Tabs from the Template

Marc-Oliver Gern
Marc-Oliver Gern
8,747 Points

In the adapter code below, set the number of tabs to 4. Code Challenge "Using Fragments for Tabs".

Seems completely broken. Did someone pass that test?

I typed in:

// Some code omitted!

public int getCount() {
    return 4;

public CharSequence getPageTitle(int position) {
    switch (position) {
        case 0:
            return "Coffee";
        case 1:
            return "Rooibos";
        case 2:
            return "Green";
        case 3:
            return "Herbal";
    return null;


4 Answers

Mathias Andersen
Mathias Andersen
13,832 Points

I am having the same problem unfortunately.

I copied and pasted this to no avail? Is it a problem with TeamTreehouse.com?