Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,127 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,693 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