Hides the activity's action bar - Android Activity

Android examples for Activity:Activity Feature

Description

Hides the activity's action bar

Demo Code


//package com.java2s;
import android.app.Activity;
import android.os.Build;
import android.view.Window;

public class Main {
    /**/*from w  w w  .j  a va 2  s. c  o m*/
     * Hides the activity's action bar
     *
     * @param activity
     *     the activity
     */
    public static void hideActionBar(Activity activity) {
        // Call before calling setContentView();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
                && activity != null) {
            activity.getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
            activity.getActionBar().hide();
        }
    }
}

Related Tutorials