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 trialRemy Benza
6,259 PointsFragments deprecated in Android 9 (Pie).
Since Fragments are deprecated in Android 9 (Pie) see:
https://plus.google.com/+IanLake/posts/WAGQiG7LaKs
Does it still make sense to follow the course 'Adding Fragments to Activities' in de Android Intermediate Track? The Fragment methods used in the video's are no longer available within Android Studio 3.3.
3 Answers
Lauren Moineau
9,483 PointsHi Remy. The Fragment
class is deprecated indeed, but the Support Library Fragments are here to stay and are part of the new Android Jetpack components.
So yes, doing the "Adding Fragments to Activities" course in the Android Intermediate Track is very much still relevant, as fragments play a big part in Android development. Just make sure to update your project by using Support Library Fragments, using this import in your fragment class:
import android.support.v4.app.Fragment;
instead of import android.app.Fragment;
as in the video.
Hope this helps :)
Alex z
9,027 Pointsi just use FragmentManager fragmentManager = getSupportFragmentManager() from androidx.fragment.app.FragmentManager and it works the same for now
Nafis Ishtiaque
9,663 PointsListFragment fragment = new ListFragment(); FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction().add(R.id.placeholder, fragment).commit(); I use it this way
b b
392 Pointsb b
392 PointsIn 2020 is this course the most up-to-date way to develop android apps? I ask because, from android dev docs, "This package is part of the Android support library which is no longer maintained. The support library has been superseded by AndroidX which is part of Jetpack. We recommend using the AndroidX libraries in all new projects. You should also consider migrating existing projects to AndroidX," which is the message for both Fragments and RecyclerView (and may have changed since your comment). I feel like I am improving my skills in both java and android by taking this course; however, I want to know: what content in TeamTreehouse's android tutorials is still relevant to the most recent android development methods?