Example usage for android.app Activity getActionBar

List of usage examples for android.app Activity getActionBar

Introduction

In this page you can find the example usage for android.app Activity getActionBar.

Prototype

@Nullable
public ActionBar getActionBar() 

Source Link

Document

Retrieve a reference to this activity's ActionBar.

Usage

From source file:Main.java

public static void setDisplayHomeAsUpEnabled(Activity activity) {
    activity.getActionBar().setDisplayHomeAsUpEnabled(true);
}

From source file:Main.java

public static void refreshActionBar(Activity activity) {
    activity.getActionBar().setDisplayShowTitleEnabled(false);
    activity.getActionBar().setDisplayShowTitleEnabled(true);
}

From source file:Main.java

public static void setActionBarTitle(Activity activity, int title) {
    activity.getActionBar().setTitle(title);
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static boolean actionBarNonNull(Activity activity) {
    return activity.getActionBar() != null;
}

From source file:Main.java

public static void setActionBarColor(Activity activity, int color) {
    activity.getActionBar().setBackgroundDrawable(new ColorDrawable(color));
    refreshActionBar(activity);/* www  .j a v  a  2 s .  co m*/
}

From source file:Main.java

public static int getActionBarHeight(Activity activity) {
    return activity.getActionBar().getHeight();
}

From source file:Main.java

public static void setupActionBar(Activity activity) {
    ActionBar actionBar = activity.getActionBar();
    actionBar.setDisplayUseLogoEnabled(true);
}

From source file:Main.java

/**
 * Setup parent navigation/*w ww  .  ja v a2  s.  c o m*/
 * @param activity to setup for
 */
public static void setupParent(Activity activity) {
    ActionBar bar = activity.getActionBar();
    if (bar != null) {
        bar.setDisplayHomeAsUpEnabled(true);
    }
}

From source file:Main.java

public static void setActionBarDrawable(Context context, Activity activity, BitmapDrawable background) {
    activity.getActionBar().setBackgroundDrawable(background);
    activity.getActionBar().setDisplayShowTitleEnabled(false);

}

From source file:Main.java

public static int getHeight(Activity activity) {
    final ActionBar actionBar = activity.getActionBar();
    if (null == actionBar)
        return 0;

    return actionBar.getHeight();
}