SlideShare a Scribd company logo
Using Action Bar
Action Bar
• The action bar is a window feature that identifies the
  application and user location, and provides user actions and
  navigation modes.
• You should use the action bar in most activities that need to
  prominently present user actions or global navigation.
• You can control the behaviors and visibility of the action bar
  with the ActionBar APIs, which were added in Android 3.0 (API
  level 11).
• To use ActionBar in previous Android versions there is a Library
  ‘ActionBarSherlock’ which can be downloaded from
  http://actionbarsherlock.com/
• ActionBarSherlock supports from Android 2.0 and over.
Using ActionBarSherlock(ABS)
  • To use ABS it has to be
    imported in eclipse and
    has to be an opened
    project.
  • Create a new Android
    project in Eclipse.
  • In create project
    window select ‘Create
    project from existing
    source’
  • In the location browse
    to the ‘library folder’ in
    ABS library which was
    downloaded.
Using ActionBarSherlock(ABS)
 • Go to the build path
   window of action bar
   project.
 • Under Libraries tab add
   jar ‘android-support-
   v4.jar’ which is already
   included in the libs
   folder.


 • Also set the build
   target to API 14 or
   higher.
 • Though ABS will be
   used with 2.0 or above
   it requires to be built
   with 4.0 or higher
Using ActionBarSherlock(ABS)
 • Now create a new
   project in Eclipse
   with minimum SDK
   7 and set Build
   target to 15.
Using ActionBarSherlock(ABS)
• Go to the project properties
  again and in the library
  section add the Previous
  created ‘ActionBarSherlock’
  library

• Since the action bar widget is
  very complex it requires a set
  of default themes. The
  library provides three core
  themes—one                  of
  which must be applied to
  each activity on which you
  want the action bar present.
• In the Manifest set theme in
  the appication tag for all
  activities or or under specific
  Activities
• ‘android:theme="@style/Theme.S
  herlock">’
• Now we are ready to integrate
  Action Bar.
• To Enable Action Bar for any
  activity, the Activity must
  extend        ‘SherlockActivity’
  instead of ‘Activity’
• To access ActionBar use
  getSupportActionBar() instead
  of getActionBar().
Adding Menu in ActionBar
• To add menu in ActionBar use menu like
  optionsMenu.
• Define in the XML but Add the tag
  ‘showAsAction’ and set it to ‘ifRoom’
• Now       in   the       Activity’s  onCreateOptionsMenu()         use
     getSupportMenuInflater() to get the menu inflater and inflate the XML
     menu file
• In                the
  onOptionsItemSelect
  ed() do the necessary
  jobs identified menu
  items by ‘id‘ set in
  the XML file
• Here is the result

More Related Content

PDF
ActionBar and Holo in Android 2+
PPTX
Java Applets
PPTX
Applet intro
PDF
20190730 android taipei
PPTX
Voluminous_Weibo
PDF
Hacking iOS Simulator: writing your own plugins for Simulator
PPTX
Waffle: A feature switch/flag/toggle application for Django
ActionBar and Holo in Android 2+
Java Applets
Applet intro
20190730 android taipei
Voluminous_Weibo
Hacking iOS Simulator: writing your own plugins for Simulator
Waffle: A feature switch/flag/toggle application for Django

Viewers also liked (20)

PDF
Lecture 3 getting active through activities
PDF
List Views
PDF
Lecture 1 Session 1 Before Getting Started
PDF
Ui layout (incomplete)
PDF
AndroidManifest
PPTX
Android GPS Tutorial
PPT
Day 6: Android BroadcastReceiver Component
PPTX
Android before getting started
PPTX
Android MapView and MapActivity
PPTX
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
PPT
Day 5: Android User Interface [View Widgets]
PPTX
Day 9: Make Your App Location Aware using Location API
PPT
Day 4: Android: UI Widgets
PPT
Android User Interface: Basic Form Widgets
PPTX
Android 1.8 sensor
PDF
Day 8: Dealing with Lists and ListViews
PPTX
Android Services
PDF
Training android
PPT
Day 4: Android: Getting Active through Activities
PDF
Day 2 android internals a quick overview
Lecture 3 getting active through activities
List Views
Lecture 1 Session 1 Before Getting Started
Ui layout (incomplete)
AndroidManifest
Android GPS Tutorial
Day 6: Android BroadcastReceiver Component
Android before getting started
Android MapView and MapActivity
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Day 5: Android User Interface [View Widgets]
Day 9: Make Your App Location Aware using Location API
Day 4: Android: UI Widgets
Android User Interface: Basic Form Widgets
Android 1.8 sensor
Day 8: Dealing with Lists and ListViews
Android Services
Training android
Day 4: Android: Getting Active through Activities
Day 2 android internals a quick overview
Ad

Similar to Action Bar Sherlock tutorial (20)

PPTX
Action bar & ActionBarSherlock
PPTX
Chapter 2 lesson-1 adding the action bar
PDF
Android Support Library: Using ActionBarCompat
PDF
The Action Bar: Front to Back
PPTX
Android ui with xml
PDF
The Action Bar: Front to Back
PPTX
ActionBarCompat Tutorial-Part 1(Prepare and Setup)
PDF
Using android's action bar
ODP
Android App Development - 05 Action bar
PDF
Android Training - Action Bar
PPTX
Chapter 2 lesson-2 styling the action bar
DOCX
Android action bar and notifications-chapter16
PDF
Android design patterns
PPTX
Android session 2-behestee
PDF
Android ActionBar Navigation reloaded
PDF
Android Development
PDF
Chapt 04 user interaction
PDF
Action Bar in Android
PDF
Android basics
PPTX
actionbar in android development course.pptx
Action bar & ActionBarSherlock
Chapter 2 lesson-1 adding the action bar
Android Support Library: Using ActionBarCompat
The Action Bar: Front to Back
Android ui with xml
The Action Bar: Front to Back
ActionBarCompat Tutorial-Part 1(Prepare and Setup)
Using android's action bar
Android App Development - 05 Action bar
Android Training - Action Bar
Chapter 2 lesson-2 styling the action bar
Android action bar and notifications-chapter16
Android design patterns
Android session 2-behestee
Android ActionBar Navigation reloaded
Android Development
Chapt 04 user interaction
Action Bar in Android
Android basics
actionbar in android development course.pptx
Ad

More from Ahsanul Karim (16)

PDF
Lecture 5: Storage: Saving Data Database, Files & Preferences
PDF
Lecture 2(b) Android Internals A Quick Overview
PDF
লেকচার ১ (ক)- শুরুর আগে:
PPTX
Day 15: Content Provider: Using Contacts API
PPTX
Day 15: Working in Background
PDF
Day 8: Dealing with Lists and ListViews
DOC
Day 4: Activity lifecycle
PDF
Day 1 Android: Before Getting Started
PDF
Mobile Banking in Bangladesh: An Incomplete Study
PDF
GCM for Android
PDF
Sensors in Android (old)
PDF
Day1 before getting_started
PPTX
Android Workshop: Day 1 Part 3
PPTX
Android Workshop Day 1 Part 2
PPTX
Introduction to Android Development: Before Getting Started
PPTX
Client-Server
Lecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 2(b) Android Internals A Quick Overview
লেকচার ১ (ক)- শুরুর আগে:
Day 15: Content Provider: Using Contacts API
Day 15: Working in Background
Day 8: Dealing with Lists and ListViews
Day 4: Activity lifecycle
Day 1 Android: Before Getting Started
Mobile Banking in Bangladesh: An Incomplete Study
GCM for Android
Sensors in Android (old)
Day1 before getting_started
Android Workshop: Day 1 Part 3
Android Workshop Day 1 Part 2
Introduction to Android Development: Before Getting Started
Client-Server

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Review of recent advances in non-invasive hemoglobin estimation
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
MYSQL Presentation for SQL database connectivity
Chapter 3 Spatial Domain Image Processing.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Advanced methodologies resolving dimensionality complications for autism neur...
Unlocking AI with Model Context Protocol (MCP)
Dropbox Q2 2025 Financial Results & Investor Presentation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Review of recent advances in non-invasive hemoglobin estimation
The AUB Centre for AI in Media Proposal.docx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
A Presentation on Artificial Intelligence
Understanding_Digital_Forensics_Presentation.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
cuic standard and advanced reporting.pdf
Encapsulation theory and applications.pdf
Empathic Computing: Creating Shared Understanding
Reach Out and Touch Someone: Haptics and Empathic Computing
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...

Action Bar Sherlock tutorial

  • 2. Action Bar • The action bar is a window feature that identifies the application and user location, and provides user actions and navigation modes. • You should use the action bar in most activities that need to prominently present user actions or global navigation. • You can control the behaviors and visibility of the action bar with the ActionBar APIs, which were added in Android 3.0 (API level 11). • To use ActionBar in previous Android versions there is a Library ‘ActionBarSherlock’ which can be downloaded from http://actionbarsherlock.com/ • ActionBarSherlock supports from Android 2.0 and over.
  • 3. Using ActionBarSherlock(ABS) • To use ABS it has to be imported in eclipse and has to be an opened project. • Create a new Android project in Eclipse. • In create project window select ‘Create project from existing source’ • In the location browse to the ‘library folder’ in ABS library which was downloaded.
  • 4. Using ActionBarSherlock(ABS) • Go to the build path window of action bar project. • Under Libraries tab add jar ‘android-support- v4.jar’ which is already included in the libs folder. • Also set the build target to API 14 or higher. • Though ABS will be used with 2.0 or above it requires to be built with 4.0 or higher
  • 5. Using ActionBarSherlock(ABS) • Now create a new project in Eclipse with minimum SDK 7 and set Build target to 15.
  • 6. Using ActionBarSherlock(ABS) • Go to the project properties again and in the library section add the Previous created ‘ActionBarSherlock’ library • Since the action bar widget is very complex it requires a set of default themes. The library provides three core themes—one of which must be applied to each activity on which you want the action bar present. • In the Manifest set theme in the appication tag for all activities or or under specific Activities • ‘android:theme="@style/Theme.S herlock">’
  • 7. • Now we are ready to integrate Action Bar. • To Enable Action Bar for any activity, the Activity must extend ‘SherlockActivity’ instead of ‘Activity’ • To access ActionBar use getSupportActionBar() instead of getActionBar().
  • 8. Adding Menu in ActionBar • To add menu in ActionBar use menu like optionsMenu. • Define in the XML but Add the tag ‘showAsAction’ and set it to ‘ifRoom’
  • 9. • Now in the Activity’s onCreateOptionsMenu() use getSupportMenuInflater() to get the menu inflater and inflate the XML menu file • In the onOptionsItemSelect ed() do the necessary jobs identified menu items by ‘id‘ set in the XML file
  • 10. • Here is the result