Question

I would like to use SYSTEM_UI_FLAG_IMMERSIVE_STICKY mode but i get this error :

SYSTEM_UI_FLAG_IMMERSIVE_STICKY cannot be resolved or is not a field

I don't know where is the problem. Here is an extract of my code :

    int uiOptions = getActivity().getWindow().getDecorView().getSystemUiVisibility();
    int newUiOptions = uiOptions;

    boolean isImmersiveModeEnabled = ((uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) == uiOptions);

    // Navigation bar hiding:  Backwards compatible to ICS.
    if (Build.VERSION.SDK_INT >= 14) {
        newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }

    // Status bar hiding: Backwards compatible to Jellybean
    if (Build.VERSION.SDK_INT >= 16) {
        newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    if (Build.VERSION.SDK_INT >= 18) {
        newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    }

    getActivity().getWindow().getDecorView().setSystemUiVisibility(newUiOptions);

And in my manifest :

   <uses-sdk android:minSdkVersion="13" android:targetSdkVersion="19" />
Was it helpful?

Solution

If this is a compile error, you need to set your build target (e.g., Project > Properties > Android in Eclipse) to API Level 19 or higher.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top