Here’s something Roman Nurik and I wrote to help with dealing with Android System UI visibility across the different API levels.

It allows you to provide a level specifying how the System UI’s visibility should be changed: LEVEL_LOW_PROFILE, LEVEL_HIDE_STATUS_BAR, LEVEL_LEAN_BACK or LEVEL_IMMERSIVE. Each one is pretty self explanatory.

To use the helper:

SystemUiHelper helper = new SystemUiHelper(
        LEVEL_LEAN_BACK,   // Choose from one of the levels
        additionalFlags);  // There are additional flags, usually this will be 0

// Show the system ui

// Hide the system ui

// Delay the hide for 2 seconds

You can find the code at this gist: