如何在android中从webviewActivity发送邮件

如何在android中从webviewActivity发送邮件,android,android-webview,android-websettings,Android,Android Webview,Android Websettings,我有一个在webViewActivity中加载的文档,在此文档中我有我的电子邮件id。当用户单击我的电子邮件id时,我想打开电子邮件应用程序,请帮助我 This is sample document. This is text contained in document. if you have any queries please contact me at mailto@examplemail.com 试试这个: @Override public b

我有一个在webViewActivity中加载的文档,在此文档中我有我的电子邮件id。当用户单击我的电子邮件id时,我想打开电子邮件应用程序,请帮助我

This is sample document. 
          This is text contained in document. if you have any queries please contact me at mailto@examplemail.com 
试试这个:

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {

         //Check whether url contains email or not.
        // To start Email Intent

        String[] mailto = { "example.com" };

    // Create a new Intent to send messages
    Intent sendIntent = new Intent(Intent.ACTION_SEND);

    // Add attributes to the intent
    sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto);
    sendIntent.putExtra(Intent.EXTRA_SUBJECT, "This is sample document.");

    sendIntent.setType("message/rfc822");
    startActivity(sendIntent);


        return true;

    }

希望这有帮助。

请检查此项:也许解决方案就在这里:感谢您宝贵的帮助。但是我得到了这样的错误-方法startActivity(Intent)对于类型MyWebViewClientThank没有定义感谢我通过添加view.getContext().startActivity(sendIntent)得到了解决方案;