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 trialglenn romaniuk
32,521 Pointsandroid studio - self destructing app - getFragmentManager - error
for public class InboxFragment extends ListFragment uses import android.support.v4.app.ListFragment;
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();
}
- 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
56,414 PointsTry get*Support*FragmentManager() instead if you are using the support libraries.