• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

can I use this with minSdkVersion 15?

N3ur0t

Lurker
Code:
if(Build.VERSION.SDK_INT < 16) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}else{
    int full = View.SYSTEM_UI_FLAG_FULLSCREEN;
    if(Build.VERSION.SDK_INT >= 19) {
        full = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
    | View.SYSTEM_UI_FLAG_FULLSCREEN
    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    }
    decorView.setSystemUiVisibility(full);
        ActionBar navButtons = getActionBar();
        navButtons.hide();
    }

setContentView(R.layout.cover);
 
Last edited by a moderator:
I forgot to say that
SYSTEM_UI_FLAG_IMMERSIVE_STICKY needs api 19
and the other needs api 16
but I don't know if ask for compile time or what
 
I forgot to say that
SYSTEM_UI_FLAG_IMMERSIVE_STICKY needs api 19
and the other needs api 16
but I don't know if ask for compile time or what

you should use @SuppressLint("NewApi") on the method that holds the respective code, otherway the Lint will complain and no compilation is possible.

E.g. in my code I have something like:
@SuppressLint("NewApi")
public static String getRealPathFromURI(Context context, Uri uri) {

boolean isNewerThanKitKat = VERSION.SDK_INT >= VERSION_CODES.KITKAT;

// DocumentProvider
if (isNewerThanKitKat && DocumentsContract.isDocumentUri(context, uri)) {
....
 
Back
Top Bottom