I am trying to intercept mailto: links in an embedded webview in my app. What I have is working ok, except when the user presses the link it is blurred upon returning to the app. Here is what I am doing in my WebViewClient
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if(url.startsWith("mailto:")){
url = url.replaceFirst("mailto:", "");
url = url.trim();
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("plain/text").putExtra(Intent.EXTRA_EMAIL, new String[]{url});
context.startActivity(i);
return true;
}
context.findViewById(R.id.loadingBar).setVisibility(View.VISIBLE);
view.loadUrl(url);
return true;
}
If I do a view.reload() it does fix the problem, but is there a better way to fix it without wasting the bandwidth? I tried invalidate() but it didn't work.
here is an example of what I'm talking about