Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
How to add custom button in existing webview android?

I want to add custom download button at specific location in webview. Like following image custom button should add besides copy button

Image

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

First you need to create the Icon for the ActionBar Follow this tutorial with the function as the following,

ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); 
ClipData clip = ClipData.newPlainText("label", "Text to copy");
clipboard.setPrimaryClip(clip);

For inside the custom (html) webView just add:

let copy = (msg) => {
        let textArea = document.createElement("#"); // name of the element
        textArea.value = msg;
        textArea.style.opacity = "0";
        document.body.appendChild(textArea);
        textArea.focus();
        textArea.select();


        try {
            let successful = document.execCommand('copy');
            let msg = successful ? 'successful' : 'unsuccessful';
            alert(msg);
        } catch (err) {
            alert('invalid', error: ' + err.msg);
            }

            document.body.removeChild(textArea);
        };
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!