In the previous posts, we discussed how to add Action Bar and handle action items clicks. In this post, I will teach you how to add ‘Up’ or Navigation button on Action Bar.
Navigation button appears along with the icon in the action bar with the caret symbol.
For Ex: GMail Application with ‘Up’ button
In the previous post, I discussed how to add Action Bar in Android applications. A simple demo application was also created with dummy Action Bar (which will not respond to clicks).
You must know how to add Action Bar in Android application before you proceed with this post. I recommend you to take a look at How to add Action Bar in Android Applications? post which will provide you insights on adding Action Bar.
In this post, I will teach you how to handle clicks on Action Bar action items. You need to create a simple Android application with Action Bar before you proceed further.
In this post, I will teach you how to add Action Bar in Android Applications. I will also discuss how to make the Action Bar work in lower SDK Android version (Backward compatibility).
You must know about Action Bar before you start creating it. I recommend you to take a look at What is Action Bar? post which will provide you basic information about Action Bar.
Adding the Action Bar in Android applcation involves three steps, they are:
In this post, I will walk you through an important Android UI component – Action Bar. You will also find list of useful posts on Action Bar tutorial following this post. Before we start creating Action Bar, we should know What is Acton Bar and its uses.
Let us begin.
To create a new Android Application Project in Eclipse, one has to fill in following details to proceed to next step in project creation.
- Application Name – Is an App name that appears to User
- Project Name – Is a Name of the project directory
- Package Name – Is an Application’s package name
- Minimum Required SDK – ???
- Target SDK – ???
- Compile With – ???
- Theme – It specifies Android UI style
We enter Application name, Project name and Package name but we usually leave default values for Minimum Required SDK, Target SDK and Compile With.