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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:56:02+00:00 2026-05-24T18:56:02+00:00

in the default android browser, when you long-press on a textbox inside of a

  • 0

in the default android browser, when you long-press on a textbox inside of a webpage you get a context menu showing several options, such as the ability to paste text into the textbox. How do I replicate this functionality with my own webview?

I looked in the android source code, specifically the code that handles context menu creation and found this:

     @Override
     public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {

         ...

         WebView.HitTestResult result = webview.getHitTestResult();
         int type = result.getType();
         if (type == WebView.HitTestResult.EDIT_TEXT_TYPE) {
             // let TextView handles context menu
             return;
         }

         ...

    }

What the code means is that when the user long-presses on a “EDIT_TEXT_TYPE” ie. a textbox, the webview does nothing. Some magical “TextView” handles the context menu. Now I’m lost, how do I get this context menu to appear in my webview?

  • 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-24T18:56:02+00:00Added an answer on May 24, 2026 at 6:56 pm

    Have you tried using registerForContextMenu(). I know it works on ListView for sure but it also works on other views.

    It should go something like this:

    registerForContextMenu(yourWebView);
    
    @Override
     public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    
           //Code for "Paste";
    
         }
    

    Hope this helps!

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

Sidebar

Related Questions

When on android default browser long press on the back key opens the history
I want to have the default android browser be able to download files of
I want to do the opposite of this: Android Browser: open several URLs, each
I noticed a problem on Android's default browser, where 100% width may actually go
I'm trying to open default browser in Android from an application's dialog with a
I would like to imitate the behavior of the default android browser - The
how the default web browser in Android supports the webGL standard for rendering 3D
The default Browser app for Android shows zoom controls when you're scrolling and also
My Android application launches the system default web browser to display a URL to
I want to specifically run the default Android browser for a given URL. I'm

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.