Android How to - Remove Title Bar and Notification Bar








Question

We would like to know how to remove Title Bar and Notification Bar.

Answer

//w w w  . jav a2 s  . co  m
import android.app.Activity;
import android.view.Window;
import android.view.WindowManager;

class ActivityUtil {
    public static void noTitleBar(Activity activity){
        activity.requestWindowFeature(Window.FEATURE_NO_TITLE); 
    }
    
    public static void noNotificationBar(Activity activity){
        final Window win = activity.getWindow(); 
        win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
}