concept action bar in category android

This is an excerpt from Manning's book 50 Android Hacks.

This is an excerpt from Manning's book Android in Action, Third Edition.
Table 21.1. The ActionBar API
Class or interface
Description
android.app.ActionBar Class that represents the action bar android.app.ActionBar.LayoutParams Nested class that represents the layout parameters with the action bar custom views android.app.ActionBar.OnMenuVisibilityListener Nested interface for receiving visibility events android.app.ActionBar.OnNavigationListener Nested interface for receiving navigation events android.app.ActionBar.Tab Nested class that represents a tab in the action bar ActionBar.TabListener Nested interface for receiving tab events The ActionBar API consists of the main ActionBar class, event listener or callback interfaces, and a class that represents tab UI components within the action bar. In addition, ActionBar defines a number of constants to control the action bar’s display options and navigation modes.
Before you can use the action bar, you have to get a reference to the ActionBar instance, as shown in the following listing.
Listing 21.2. Getting access to the action bar
public class MainActivity extends Activity { : ActionBar bar = getActionBar(); if (bar != null) { ... } :Listing 21.2 gets a reference to the action bar via the current Activity. Note the test if (bar != null);—not all themes have an action bar, so it’s a good practice to check for the presence of the action bar before performing operations on it.
The action bar, which replaces the traditional application title bar on Android applications, is totally under your application’s control. You can change its appearance and content based on the application context. For example, you can add titles, icons, tabs or list-based navigation, and menu items. You can style the action bar with colors and fonts as you wish. You can even hide and show the action bar and remove it. All of this is explained throughout this chapter; system bar notifications are covered in chapter 8. The action and system bars are shown in figure 21.1.
Android 3.0 automatically assigns the holographic theme with an action bar to applications that target Android 3.0. To target Android 3.0 you need to specify a minimum SDK version of 11 or a target SDK version of 11 in the manifest file; note that API 11 refers to Android 3.0. The following listing shows a manifest file (AndroidManifest.xml) that targets Android 3.0.