Reputation: 232
i have a document which is loaded in webViewActivity, in this document i have my email id. when users clicks my email id i want to open email app, please help me.
This is sample document.
This is text contained in document. if you have any queries please contact me at [email protected]
Upvotes: 0
Views: 66
Reputation: 10100
Try this :
@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;
}
Hope this helps.
Upvotes: 2