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 Android Fragments Managing Fragments Managing the Back Stack

Rifqi Fahmi
Rifqi Fahmi
23,164 Points

The addToBackStack() now support on Fragment (android.app) !

When i follow this video I try not to change the package and still use the Fragment from android.app and it work fine. I use android studio 2.1.2

Is the problem already fixed by android Ben Deitch ? If yes just reminder here hehe

Daniel Bowen
Daniel Bowen
8,577 Points

This is true for me as well. I believe there definitely should be a teacher's notes change for this course.

Simon Coates
Simon Coates
28,694 Points

android extended AppCompatActivity by default for me, so I swapped in Activity and made some trivial code changes to confirm to myself that code I was viewing was fresh. Back button seemed to work in either case. So unless there's further information, the gotcha doesn't seem to apply.

3 Answers

Yes, adding fragmentTransaction.addToBackStack(null) worked for me perfectly. there should be a update in this video.

aldoolivares
aldoolivares
14,478 Points

I am using Android Studio 2.2 RC 2 and addBackStack() works just fine.

aldoolivares
aldoolivares
14,478 Points

Ben Deitch Ben Jakuben addToBackStack seems to be working fine now. Shouldnt there be a teacher's notes about this?

Rifqi Fahmi
Rifqi Fahmi
23,164 Points

I think u should follow the instruction to use the android.support in order to follow the video because u will find some method in the video are not exist if you use the android.app