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

Error?

I keep getting a message saying that it cannot resolve symble fm?

public SectionsPagerAdapter( Context context FragmentManager fm) {

    super(fm);
    mContext = context;
}

also get support actions bar and get support fragment manager comes up as an error?

// Set up the action bar. final ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(this, getSupportFragmentManager());

3 Answers

Jon Kussmann
PLUS
Jon Kussmann
Courses Plus Student 7,254 Points

What type of activity is your activity extending from? You might get the second error if you are using/not using a support version... or rather, mixing them around.

As for the first, it looks like you are missing a comma between your context and your fragment manager.

public SectionsPagerAdapter( Context context FragmentManager fm) {
public SectionsPagerAdapter( Context context, FragmentManager fm) {

public class SectionsPagerAdapter extends FragmentPagerAdapter

YES! Thanks now i just have an error with

public class SectionsPagerAdapter extends FragmentPagerAdapter (it say should be declared in a file name SectionsPagerAdapter.java but it is?)

and

final ActionBar actionBar = getSupportActionBar(); (cannot resolve method)