Hiding the Activity title in Android

The requestWindowFeature(Window.FEATURE_NO_TITLE) method of Activity must be called to hide the title. But, it must be coded before the setContentView method.

You can also hide the title of an activity if desired (such as when you just want to display a status update to the user). To do so, use the requestWindowFeature() method and pass it the Window.FEATURE_NO_ TITLE constant, like this:

package  net.learn2develop.Activities;
import android.app.Activity; 
import android.os.Bundle;
import android.util.Log;
import android.view.Window;

public class MainActivity extends Activity { String tag = “Events”;

/** Called when the activity is first created. */

@Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
//---hides the title bar--- requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main); Log.d(tag, “In the onCreate() event”);

}
}

Leave a Reply

Your email address will not be published. Required fields are marked *