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

glenn romaniuk
glenn romaniuk
32,520 Points

android studio - self destructing app - getFragmentManager - error

  1. for public class InboxFragment extends ListFragment uses import android.support.v4.app.ListFragment;

  2. The proj wont compiles as the sectionspageradapter returns a fragment based on import android.app.Fragment. i replaced the reference with android.support.v4.app.ListFragment

@Override
    public Fragment getItem(int position) {


        return new InboxFragment();
    }
  1. now the mainactivity expression is failing
mSectionsPagerAdapter = new SectionsPagerAdapter(this, getFragmentManager());

SectionsPagerAdapter is expecting a import android.support.v4.app.FragmentManager but the getFragmentManager() which is located in the activity.java how can i fix this the getFragmentManager function is in the sdk

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

Try get*Support*FragmentManager() instead if you are using the support libraries.