如何打印内部的WebView Android中选定的文本 [英] How to print the selected text inside webview in android

查看:178
本文介绍了如何打印内部的WebView Android中选定的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Android的应用程序中的的WebView 内选定的文本。打印此文.. 怎么样 ?你的帮助是非常AP preciated。

I want to get the selected text inside a webview in android application. and print this text .. how ? your help is highly appreciated.

我的意思是,在的WebView 文本高亮显示。

I mean the text highlighted in the webview.

推荐答案

它可以帮助你。

  webview.setWebViewClient(new WebViewClient()
  {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url)
    {
        // progressBar.show();
        // view.loadUrl(url);

        if (url.startsWith("mailto:") || url.startsWith("tel:")) 
        {

                    int len = url.length();
                    char[] desArray = new char[len - 7];
                    url.getChars(7, len, desArray, 0);
                    String newString1 = new String(desArray);
                    newString1.trim();
                    Log.d("Str", newString1 + "");
                    sendGmail(newString1, 1);
                    return true;
        }
        else 
        {
                    return super.shouldOverrideUrlLoading(view, url);
        }
    }

这code是获取从web视图的电子邮件地址并获取电话号码。

This code is for getting the email Address from webview and getting the phone numbers.

这篇关于如何打印内部的WebView Android中选定的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆