Thursday, May 19, 2011

Android - Full Screen App

By default an Android app has a title bar and allows the user to pull down the task bar while your app is open.


The following code allows you to remove the title bar and hide the task bar. This would be your onCreate method in your activity.

 public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  
        //No title   
        requestWindowFeature(Window.FEATURE_NO_TITLE);   
        //Full screen (no task bar)  
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);   
        setContentView(R.layout.main);  
 }  

Result: