Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7412277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:31:00+00:00 2026-05-29T06:31:00+00:00

I am working with action bars for the first time and would like to

  • 0

I am working with action bars for the first time and would like to know for certain examples that show how to add new actions/buttons to the action bar and an intent on each button to load other classes.

A small code snippet with an xml layout would be of much help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:31:01+00:00Added an answer on May 29, 2026 at 6:31 am

    The most simple approach is to use the menu resource and use an showAsAction attribute for each item. Here is an example:

    <?xml version="1.0" encoding="utf-8"?>
    <menu
      xmlns:android="http://schemas.android.com/apk/res/android">
    
        <item
            android:id="@+id/item_check_all"
            android:title="@string/menu_check_all"
            android:titleCondensed="@string/menu_check_all_cond"
            android:icon="@drawable/checked"
            android:visible="true"
            android:enabled="true"
            android:showAsAction="ifRoom"
        ></item>
    
        <item
            android:id="@+id/item_uncheck_all"
            android:title="@string/menu_uncheck_all"
            android:titleCondensed="@string/menu_uncheck_all_cond"
            android:icon="@drawable/unchecked"
            android:visible="true"
            android:enabled="true"
            android:showAsAction="ifRoom"
        ></item>
    
        <item
            android:id="@+id/item_add_selected_reservations"
            android:title="@string/menu_add_reservations"
            android:titleCondensed="@string/menu_add_reservations_cond"
            android:icon="@drawable/calendar_plus"
            android:visible="true"
            android:enabled="true"
            android:showAsAction="always"
        ></item>
    
        <item
            android:id="@+id/item_open_calendar"
            android:title="@string/menu_open_calendar"
            android:titleCondensed="@string/menu_open_calendar_cond"
            android:icon="@drawable/calendar"
            android:visible="true"
            android:enabled="true"
            android:showAsAction="never"
        ></item>
    
    </menu>
    

    Items which have an “ifRoom” specified are added to the action bar if there is space available. Other possible values are “always” and “never” with the obvious meaning.

    This will even work with the compatibility library.

    Here is more info: http://developer.android.com/guide/topics/ui/actionbar.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anybody know the working of android.intent.action.SYNC ? How would one go about testing
I have a working Action and JSP form that I'm using for creating new
I'm working on such kind of an action queue thread and I would like
I'm working on a Newsfeed action. I have active friendships and i would like
I'm working through the Grails In Action book and have noticed 2 instances that
I'm working through the Grails in Action book, and I'm stuck at that part
while working with WF 4.0 I noticed that the WorkflowApplication class exposes action properties
I'm working with a WSDL that has a different SOAP Action in the header
I have an action that when I was working on during development was called
An application I'm working on requires logging of actions, user who performs the action,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.