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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:36:08+00:00 2026-05-27T22:36:08+00:00

I have a customized EditText, which need to do customized paste. I overrode onTextContextMenuItem(int

  • 0

I have a customized EditText, which need to do customized “paste”.

I overrode onTextContextMenuItem(int id) to handle “paste” requested by selecting context menu.

@Override
public boolean onTextContextMenuItem(int id) {
  switch(id){
  case android.R.id.paste:
    doMyPaste();
    return true;
  }
}

This works in Android before 3.0.
In 3.0, however, there is a small “paste” widget near the cursor widget if it’s long-pressed, or the cursor is tapped.
enter image description here
When user do “paste” from this widget, the onTextContextMenuItem(int id) won’t be invoked. As a result, I can’t do the customized paste.
Do any one knows what that small “paste” widget is? Which method should I overrode to do a my own “paste”?

  • 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-27T22:36:08+00:00Added an answer on May 27, 2026 at 10:36 pm

    To cover all bases, this has to be API-specific, so you must commit to doing it two different ways anyway.

    For new APIs, the new android.content.ClipboardManager interface provides everything you need to transfer any MIME type you want.

    For old APIs, you must be tricksy if you expect to play with the old android.text.ClipboardManager. Just base-64 encode the data of your Image (or whatever) and send that as text. On the receiving side, just reverse the process.

    You can even “auto-detect” by determining whether you have android.text.ClipboardManager or android.content.ClipboardManager and act accordingly!

    Also, your handler method should be returning super.onTextContextMenuItem(id) if you don’t process anything. Maybe an editing artifact?

    As far as the Paste Widget, that’s not present in old APIs, or may be present on certain OEM UIs, and you are probably left with implementing that yourself, or using a degraded method of interaction. Once you put text on the clipboard, the Paste command shows up in the “normal” context menus.

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

Sidebar

Related Questions

I need to create my own grid which will have customized paging and sorting.
I have customized the contextual menu for my Cocoa application such that only certain
I have created customized combobox which extends JCombobox. It is having checkboxes in popup
I have customized uitableViewcell in which each cell show four data which are related
In my magento project the search result not displays. I have customized my magento.
We have a lot of customized spreadsheet solutions that are being used and we
I have a lot of customized javascript and layout design, and I want to
I have to develop a customized tab control and decided to create it with
i have taken the default asp.net mvc template and customized to work for me.
I have an application that has a list of buttons and has customized tooltips.

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.