Java tutorial
//package com.java2s; //License from project: Open Source License import android.annotation.SuppressLint; import android.app.Activity; import android.os.Build; public class Main { @SuppressLint("NewApi") public static void setStatusBarColor(Activity activity, int color) { if (isAboveL()) { activity.getWindow().setStatusBarColor(color); } } public static boolean isAboveL() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; } }