Hiding status bar requires your application screen should be full screen.
In order to hide status bar follow below steps.
Step 1) Your screen don't have title.
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Step 2) Copy above code in your activity onCreate method.