2013-10-28 5 views
0

webViewActivity에로드 된 문서가 있습니다.이 문서에는 내 이메일 ID가 있습니다. 사용자가 내 이메일 ID를 클릭하면 이메일 앱을 열고 싶습니다. 도와주세요.android에서 webviewActivity에서 메일을 보내려면

This is sample document. 
      This is text contained in document. if you have any queries please contact me at [email protected] 
+0

다음을 확인하십시오. http://stackoverflow.com/questions/9387999/how-to-open-webview-link-to-new-activity – Nostradamus

+0

해결책은 여기에 있습니다. http://stackoverflow.com/questions/2197741/how-to-send-email-from-my-android 응용 프로그램 –

답변

2

이 시도 :이 도움이

@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; 

    } 

희망을.

+0

도움을 주셔서 감사합니다. 하지만 난 이런 오류가있어 - StartActivity (의도) 메서드 MyWebViewClient에 대한 정의되지 않았습니다 – Venkat

+0

코드를 추가하시기 바랍니다 수 있습니다. –

+0

감사합니다. 나는 view.getContext()를 추가하여 솔루션을 얻었습니다. startActivity (sendIntent); – Venkat

관련 문제