# Nav Bar reappear on pressing home and doesnt hide anymore

**URL:** <https://forums.fusetools.com/t/nav-bar-reappear-on-pressing-home-and-doesnt-hide-anymore/7788>\
**Category:** How-to Discussions\
**Created:** [June 18, 2019, 2:11pm UTC](https://forums.fusetools.com/t/nav-bar-reappear-on-pressing-home-and-doesnt-hide-anymore/7788 "2019-06-18T14:11:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justin](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@Justin](https://forums.fusetools.com/u/Justin)\
**Post date:** [June 18, 2019, 2:11pm UTC](https://forums.fusetools.com/t/nav-bar-reappear-on-pressing-home-and-doesnt-hide-anymore/7788/1 "2019-06-18T14:11:34Z")

</div>

```auto
using Uno;
using Uno.Collections;
using Uno.Compiler.ExportTargetInterop;
using Fuse;
using Fuse.Scripting;

public class NavbarModule : NativeModule
{
    public NavbarModule()
    {
        AddMember(new NativeFunction("HideBar", (NativeCallback)HideBar));
        AddMember(new NativeFunction("ShowBar", (NativeCallback)ShowBar));
    }

    static object HideBar(Context c, object[] args)
    {
        SetNavigationBarVisible(false);

        return null;
    }

    static object ShowBar(Context c, object[] args)
    {
        SetNavigationBarVisible(true);

        return null;
    }

    [Foreign(Language.Java)]
    static extern(Android) void SetNavigationBarVisible(bool visible)
    @{
        android.app.Activity rootActivity = @(Activity.Package).@(Activity.Name).GetRootActivity();

        rootActivity.runOnUiThread(new Runnable() {
            @Override
            public void run() { android.view.Window window = @(Activity.Package).@(Activity.Name).GetRootActivity().getWindow();
                // This code will always run on the UI thread, therefore is safe to modify UI elements.

                if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT)
                {
                    android.view.View decorView = window.getDecorView();

                    int uiOptions = decorView.getSystemUiVisibility();

                    if (visible)
                    {
                        uiOptions &= ~(android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | android.view.View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
                    }
                    else
                    {
                        uiOptions |= android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | android.view.View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
                    }

                    decorView.setSystemUiVisibility(uiOptions);
                }
            }
        });
    @}

    static extern(!Android) void SetNavigationBarVisible(bool visible)
    {
        debug_log "SetNavigationBarVisible not available on this platform";
    }
}

```

how to create onResume activity so navbar hide again after coming back from Home.

---

<div class="post-metadata">

**Author:** ![aeq](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/aeq/32/129_2.png) [@aeq](https://forums.fusetools.com/u/aeq)\
**Post date:** [June 19, 2019, 7:51am UTC](https://forums.fusetools.com/t/nav-bar-reappear-on-pressing-home-and-doesnt-hide-anymore/7788/2 "2019-06-19T07:51:49Z")

</div>

Try something like this function and overrides I found:

> <https://github.com/fuse-open/fuselibs/blob/ee4df9deacb400211bcc30bbd11cfa6ccf787888/Source/Fuse.Platform/Android/SystemUI.uno#L105>

---

<div class="post-metadata">

**Author:** ![Justin](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@Justin](https://forums.fusetools.com/u/Justin)\
**Post date:** [June 19, 2019, 10:04am UTC](https://forums.fusetools.com/t/nav-bar-reappear-on-pressing-home-and-doesnt-hide-anymore/7788/3 "2019-06-19T10:04:13Z")

</div>

Thanks for help but i dont have much knowledge about Java (Thats why i choose Fuse). I have tried but it doesnt working. If you able to give an example it would be great. How to implement below code in Fuse?

@Override  
public void onWindowFocusChanged(boolean hasFocus) {  
super.onWindowFocusChanged(hasFocus);  
if (hasFocus) {  
hideSystemUI();  
}  
}

private void hideSystemUI() {  
// Enables regular immersive mode.  
// For “lean back” mode, remove SYSTEM\_UI\_FLAG\_IMMERSIVE.  
// Or for “sticky immersive,” replace it with SYSTEM\_UI\_FLAG\_IMMERSIVE\_STICKY  
View decorView = getWindow().getDecorView();  
decorView.setSystemUiVisibility(  
View.SYSTEM\_UI\_FLAG\_IMMERSIVE  
// Set the content to appear under the system bars so that the  
// content doesn’t resize when the system bars hide and show.  
| View.SYSTEM\_UI\_FLAG\_LAYOUT\_STABLE  
| View.SYSTEM\_UI\_FLAG\_LAYOUT\_HIDE\_NAVIGATION  
| View.SYSTEM\_UI\_FLAG\_LAYOUT\_FULLSCREEN  
// Hide the nav bar and status bar  
| View.SYSTEM\_UI\_FLAG\_HIDE\_NAVIGATION  
| View.SYSTEM\_UI\_FLAG\_FULLSCREEN);  
}

// Shows the system bars by removing all the flags  
// except for the ones that make the content appear under the system bars.  
private void showSystemUI() {  
View decorView = getWindow().getDecorView();  
decorView.setSystemUiVisibility(  
View.SYSTEM\_UI\_FLAG\_LAYOUT\_STABLE  
| View.SYSTEM\_UI\_FLAG\_LAYOUT\_HIDE\_NAVIGATION  
| View.SYSTEM\_UI\_FLAG\_LAYOUT\_FULLSCREEN);  
}
