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! While you're at it, check out some resources Treehouse students have shared here.

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

Compilation error in getCount(): Code Challenge seems broken

Hello :)

I'm trying to do this block of exercise, and the first one is a simple task to set 4 tabs to the Fragment.

But when I add 4 to return, it shows me a compilation error. Am I doing something wrong?

// Some code omitted!

@Override
public int getCount() {
    return 4;
}

@Override
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;
}

Thx

4 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Looks like an update must have broken something. I'll take a look and see that this gets fixed today. Thanks for the heads up!

Thank you Ben :)

Calvin Nix
Calvin Nix
43,828 Points

Hey Danilo,

Thank you for posting this :) I was going crazy trying to figure out what the heck I was doing wrong!

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Sorry all! I just deployed the fix. I broke a library class with an update based on the latest code challenges I'm working on for my new course. I just verified that it works now. :)