Reputation: 1821
I'm setting WebView
's content as;
String displayBodyText = "<a href="scheme:/user_abd/data?q=from%3A%22ammar%40mydomain.com%22#title=%40Ammar%20">Ammar</a>"
webView.loadData(displayBodyText , "text/html", "utf-8");
And set the WebViewClient
as;
linkDetailWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.d("TAG", url);
return true;
}
});
When clicked on the link in data, I'm getting scheme:/user_abd/data?q=from:
instead of scheme:/user_abd/data?q=from%3A%22ammar%40mydomain.com%22#title=%40Ammar%20
.
I'n unable to get this behavior of WebView
.
Upvotes: 1
Views: 1689
Reputation:
Try this code I checked it works for me
String displayBodyText = "<a href=\"scheme:/user_abd/data?q=from:"[email protected]"#title=@Ammar\">Ammar</a>";
web_view.loadData(displayBodyText , "text/html", "utf-8");
Webview client
web_view.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
String m_url = URLDecoder.decode(url);
Log.e("TAG",m_url);
return true;
}
});
Upvotes: 1
Reputation: 150
You have to escape your invalid characters from your string:
String displayBodyText = "<a href=\"scheme:/user_abd/data?q=from%3A%22ammar%40mydomain.com%22#title=%40Ammar%20\">Ammar</a>";
You can't have double quotes in a string without escaping them: Escape double quotes in Java
Upvotes: 0