2

I have an activity lets call it LeanbackSettingsActivity. I have 3 Fragments in it.

'FirstStepFragment' - Which houses a couple options to go to one of the other 2 fragments: Option1 -> SubFragment1 Option2 -> SubFragment2

All 3 fragments extend 'GuidedStepFragment'.

If I press the 'Back' button on my Android TV remote while in SubFragment1 or SubFragment2, it goes back to FirstStepFragment. That's fine, but if I press the back again (when I'm in FirstStepFragment), it goes to a blank screen. Press it again, and it exits.

I'm assuming its the activity that is displaying while the screen is blank.

How can I fix the behavior so when I leave FirstStepFragment it also finishes the activity?

Here's the onCreate from my activity:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        Log.d(TAG, "onCreate");
        super.onCreate(savedInstanceState);
        if (savedInstanceState == null) {
            GuidedStepFragment.add(getFragmentManager(), new FirstStepFragment());
        }
    }
death2all110
  • 222
  • 3
  • 14

1 Answers1

2

Please use [GuidedStepFragment.addAsRoot(...)](http://developer.android.com/reference/android/support/v17/leanback/app/GuidedStepFragment.html#addAsRoot(android.app.Activity, android.support.v17.leanback.app.GuidedStepFragment, int))

Fung
  • 961
  • 1
  • 8
  • 17