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 7499947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:59:39+00:00 2026-05-29T19:59:39+00:00

Just stated learning about the ICS Actionbar. I am working with Action Bar Sherlock

  • 0

Just stated learning about the ICS Actionbar. I am working with Action Bar Sherlock to be backwards compatible for things I want to do and have gone though lots of the source code on its samples.

I have 3 image views, I want to set a listener for a long click on all 3. When a user long clicks one I will show an ActionMode over the action bar letting them take a picture. Since the action bar seems to work just like the menu, how do I know what ImageView triggered my ActionMode after they click a button from it?

Don’t have a lot of code done right now because I am just starting looking into it and this was the first thing I wanted to do.

  • 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-29T19:59:42+00:00Added an answer on May 29, 2026 at 7:59 pm

    To initiate an action mode, you need to provide an instance of the ActionMode.Callback class. For something like this, you should create a constructor inside this class which accepts some relevant information about the image view.

    public static class ImageActionMode extends ActionMode.Callback {
        private final int viewId;
    
        public ImageActionMode(View view) {
            viewId = view.getId();
        }
    
        public boolean onActionItemClicked (ActionMode mode, MenuItem item) {
            //Do something with viewId as the target
        }
    
        //Other callbacks
    }
    

    You could also keep a reference to the full ImageView or anything else that is what you need to respond to the options item.

    Now when you start the action mode you would do something like this:

    public void onLongPress(View view, /*whatever else...*/) {
        startActionMode(new ImageActionMode(view));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have just started learning about xsd as I want to use it
I just recently have started learning about the wonders of **kwargs but I've hit
I have just started learning java and i have about 8 months time. My
I just started learning about ASP.NET, and I have a couple of questions. Am
I have just started learning about Android and I was planning on making a
Very confused over this. I've just started learning about pointers and have now decided
We just started learning about class inheritance and attribute lookup in python. I have
I have just started learning about Java server faces and successfully tested out my
I just started learning about database normalization and I have a question about one
I have just started learning basics about Graphics2D class, So far I am able

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.