Mark Mark - 1 year ago 124
Android Question

Can you detect whether an application is in immersive mode in Fragment.onCreateView?

In a fragment I have implemented a

so that I can enter/exit immersive mode when
is detected.

is used to move between these fragments on swipe left/right. If you enter immersive mode then swipe to a new fragment the UI remains in immersive mode.

However, in the
method of the new fragment I need to detect whether the UI is in immersive mode to when creating my listener.

I have tried calling
on the new view but this returns

Is there a method for detecting whether the application is in immersive mode from any view or fragment regardless of whether that initiated the transition to immersive mode?

Answer Source

@Mark, it sounds like you may have gotten it resolved based on my previous comment: use a View owned by the Activity to call getSystemUiVisibility() rather than the Fragment.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download