Adding actions to ActionBar
With Android 3.0 (Honeycomb, API level 11), Android introduced a uniform title, such as a widget that docks to the top of the screen, called ActionBar. It allows apps to add activity-specific actions to the top of the device screen, just below the status bar. We will define two actions for the POIListActivity
class: New
, to create a new POI, and Refresh
, to refresh the cache of POIs from the device's local storage.
The Activity
class provides the following virtual methods that can be overridden to add actions:
Virtual Method |
Description |
---|---|
|
It allows the creation of the actions either through API calls or through inflating an XML definition |
|
It is called when an action in |