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

Support Library for Fragment

Hi all, I am using the support library v4 for Fragment. But when I ran my app on a device with 4.1 on it, the app just crashed. If I use the android.app.Fragment, my app can run successfully on that device. So I am wondering in order to be compatible to old devices, should I build two separate apps, one using the support library, the other doesn't ? Thank you so much!

3 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

The support library is for backwards compatibility, so it should not give you problems on 4.1. Can you share details about the crash and/or your code where you are using it?

Hi Ben,

Thank you for your reply. I figured that I should use getSupportFragmentManager() instead of getFragmentManager(). getFragmentManager() simply returns null when using the support library.

-Raymond