Android examples for android.app:Action Bar
If there is an action bar, this method hides or shows it, else does nothing.
import android.annotation.SuppressLint; import android.app.ActionBar; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.os.Build; public class Main{ /**/* w w w .ja va 2 s. c om*/ * If there is an action bar, this method hides or shows it, else does nothing. * @param act The activity which's ActionBar (if available) is to be shown or hidden. * @param hide If <code>true</code> the bar will be hidden, else shown if available. */ public static final void hideActionBar(Activity act, boolean hide) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { ActionBar bar = act.getActionBar(); if (bar != null) { if (hide) { bar.hide(); } else { bar.show(); } } } } }