Java tutorial
//package com.java2s; import android.content.Context; import android.os.Build; import android.view.Window; public class Main { public static void setStatusBarColorRes(Window window, int colorId, Context context) { setStatusBarColor(window, context.getResources().getColor(colorId)); } public static void setStatusBarColor(Window window, int color) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { window.setStatusBarColor(color); } } }