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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:04:21+00:00 2026-05-29T23:04:21+00:00

I was reading the new Android Design Standards here: http://developer.android.com/design/patterns/selection.html and was wondering first

  • 0

I was reading the new Android Design Standards here: http://developer.android.com/design/patterns/selection.html and was wondering first how to make my ListView selectable (because long presses are now supposed to select items, not show a context menu like before), then to figure out how to pass that information to the ActionBar so I can make a contextual ActionBar based on what is selected (and how many items are selected). I’ve checked out several sites, including http://www.vogella.de/articles/AndroidListView/article.html but it doesn’t show how to do it for ICS with the ActionBar.

I apologize for not giving any code, but I haven’t had to do anything with listviews aside from making custom ones.

  • 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-29T23:04:21+00:00Added an answer on May 29, 2026 at 11:04 pm

    For the first part (select list item), you need to do a couple things:

    -Depending on the context, set your ListView to either single or multiple choice (depending on your app), using the setChoiceMode method.

    lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    // or
    lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    

    -in order to mark the item as selected, just listen for a long press and call the ListView’s setItemChecked method.

    lv.setItemChecked(position, true);
    

    Finally, in order for the listview item to show as selected, you need to add the following attribute to the custom XML layout for that listview item:
    android:background="?android:attr/activatedBackgroundIndicator"

    For creating contextual Action Bar, the process is a little more detailed, but it’s outlined in the Android Developer guide in the Using Contextual Action Mode section.

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

Sidebar

Related Questions

I'm having trouble with http://developer.android.com/resources/articles/painless-threading.html It's been touted as a great source of information
I've been reading about the new developer-only RC0 for Silverlight, and the fact that
After reading Jeff's blog post and being fairly new to GUI programming, I'm wondering
I'm pretty new to android, and just finished setup my environment and reading some
I am currently developing my first Android application by reading Dev Documentation at Android
I'm quite new to Android and I have been reading the Professional Android 2
i am new in android and java ... i am reading from couples of
Possible Duplicate: reading a specific file from sdcard in android I'm trying to make
I'm new to Android. I've been reading several posts and documentation about Threads/Services, and
Im reading about the new Android Lint rules, and I find to prevent overdraw

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.