I'm using this code to hide the top status bar
public static void removeNotificationBar(Activity activity) {
    if (activity != null) {
        activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
}
But it seems I need to enable it back on in some cases in my activity and I am unable ti figure out what flags to pass to the window to re-enable the status bar.
Any ideas?