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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:59:21+00:00 2026-05-31T15:59:21+00:00

What I want to do I have several items in a ListView. When I

  • 0

What I want to do
I have several items in a ListView. When I longpress an item I have a contextmenu which pops up with several options. On of these options is “Share task”. When the user selects “Share task” I want to have the Title/Text of the item they long-pressed to be retrieved and passed to a method.

What’s I’ve managed to do so far
I have managed to get the id and position of the item in the listView which the contextmenu was called up using the method show below.

@Override
public boolean onContextItemSelected(MenuItem item)
{
    switch (item.getItemId())
    {
    case R.id.menuShare :
        //Identify list item on which editing needs to be performed
        AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();

        //METHOD TO SHARE TASK NEEDS TO GO HERE
        shareTask();
        return true;
    }
    return super.onContextItemSelected(item);
}

What I need help with
I can’t figure out how I can now get the text/title of the item on which the contextmenu was called. I intend to then pass this string to the shareTask() function to fire up a chooser. The title I have passed will then be used for example as the title of an email.

Thank you very much in advance!

  • 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-31T15:59:22+00:00Added an answer on May 31, 2026 at 3:59 pm

    You should use the following code to get text of list item:

    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    //list item's text on which long-pressed is performed
    String text = yourListView.getAdapter().getItem(info.position).toString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF ListView with many items in it. When I select several
I have an unordered list which contains several items called 'oListItems' the UL has
I have a loginview in my webform that has several Items. I want to
I have several objects of type Item. The items are ordered but their ordering
I have defined a user resource, and each user has several items. Now I
I have several thread pools and I want my application to handle a cancel
I have several different lists I want to call. They all have the same
I have several unordered lists that I want to display like this: <ul> <li><img></li>
I have several workflows where the users want to set the number of days
I have several sites that I want to link back to the main site

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.