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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:37:32+00:00 2026-05-22T21:37:32+00:00

I have a ListView where each item is a TextView . I want to

  • 0

I have a ListView where each item is a TextView.

I want to enable the long press behaviour similar to an EditText that displays the default context menu with items like “Select all”, “Cut all”, “Copy all”, etc.

Is there an easy way to enable this for a TextView?

  • 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-22T21:37:32+00:00Added an answer on May 22, 2026 at 9:37 pm

    I think I have a solution.
    Just call
    registerForContextMenu(yourTextView);

    and your TextView will be registered for receiving context menu events.

    Then override onCreateContextMenu in your Activity:

    @Override
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
        //user has long pressed your TextView
        menu.add(0, v.getId(), 0, "text that you want to show in the context menu - I use simply Copy");
    
        //cast the received View to TextView so that you can get its text
        TextView yourTextView = (TextView) v;
    
        //place your TextView's text in clipboard
        ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); 
        clipboard.setText(yourTextView.getText());
    }
    

    Hope this helps you and anyone else looking for a way to copy text from a TextView

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

Sidebar

Related Questions

I have a listview with a textview as each item. I want to change
i have this listview each listview item has a textview that have background ,
I have a ListView, and I want to customize the layout of each item
I have a ListView in which each item has a complex layout that contains,
I have a listview ,each item is a textView with property autoLink=web|email.Link will work
I have a listview and each item has a title, some info, and a
I have a ListView composed of LinearLayouts. Inside each is an ImageView, TextView and
I have a listview with several items that are created dynamically, each has two
I have an app using a ListView as a main screen. Each row displays
I have a listview with custom rows and that extends SimpleAdapter. Each row consist

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.