Im using the following code to change the color of status bar. When I try to do so, the app crashes.
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(getApplicationContext().getResources().getColor(Color.BLUE));