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

  • SEARCH
  • Home
  • 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 8435203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:51:10+00:00 2026-06-10T06:51:10+00:00

I using action bar by sherlock. I’m trying to implement it into my app.

  • 0

I using action bar by sherlock. I’m trying to implement it into my app. But seems like I am missing something to make it to work. Please check on my codes. My app doesnt do anything when i tap on the action buttons. Below are my codes and my xml.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getSupportMenuInflater();
    inflater.inflate(R.menu.activity_main, menu);


         menu.add("Share")
         .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

         menu.add("Save")
         .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);

         menu.add("Set")
         .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);

        return super.onCreateOptionsMenu(menu);

}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
    case R.id.share:
        new share(this).execute(image_url);
        return true;
    case R.id.save:
        new save(this).execute(image_url);
        return true;
    case R.id.set:
        new set(this).execute(image_url);
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

My menu xml

<menu xmlns:android="http://schemas.android.com/apk/res/android">

 <item android:id="@+id/share"
       android:title="@string/share"/>

 <item
        android:id="@+id/save"
        android:title="@string/save"/>

    <item
        android:id="@+id/set"
        android:title="@string/set"/>


</menu>
  • 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-06-10T06:51:11+00:00Added an answer on June 10, 2026 at 6:51 am

    You can set OnMenuItemClickListener on your menu items like this:

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    
        menu.add("Share")
            .setOnMenuItemClickListener(this.mShareButtonClickListener)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    
        // Other items...
    
        return super.onCreateOptionsMenu(menu);
    }
    

    Then you create your OnMenuItemClickListener:

    OnMenuItemClickListener mShareButtonClickListener = new OnMenuItemClickListener() {
    
        @Override
        public boolean onMenuItemClick(MenuItem item) {  
    
             // Example of action following your code
             new share(YouActivity.this).execute(YouActivity.this.image_url);
             return false;
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ActionBarSherlock to implement action bar for Android 2.1 platform. But in
I'm trying to implement an action bar in my app. I'm trying to do
I'm making a new android app, and I am using the action bar sherlock
I'm trying to add a next button in my app action bar ( Sherlock
I'm using the Sherlock Action Bar extensively throughout my application, but I have an
I'm trying to build the sample project Action Bar Styled using the Action Bar
I am developing Android 2.1 API 7 app. To implement action bar , I
I am using ActionBarSherlock to implement action bar on my Android 2.1 API 7
My own project is using Android 2.1 API 7 . To implement action bar,
I am using sherlock action bar Version 4.1.0 (2012-05-17) . How can I change

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.