Android - Carregar PDF dentro da webview
Eu tenho este código de webview e quero tornar possível abrir os arquivos PDF quando um usuário clica em um link de PDF. Aqui está o código, você pode me dizer o que eu tenho que colocar dentro da área PDF disso? Eu tentei muitas maneiras diferentes e não consigo visualizar o PDF. Obrigado pela ajuda.
webview.setWebViewClient ( new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// do your handling codes here, which url is the requested url
// probably you need to open that url rather than redirect:
if (url.startsWith("tel:")) {
startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse(url)));
} else 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});
startActivity(i);
} else if (url.startsWith("geo:")) {
try {
} catch (Exception e) {
System.out.println(e);
}
} else if (url.endsWith("pdf")) {
try {
} catch (Exception e) {
System.out.println(e);
}
} else {
view.loadUrl(url);
}
return true;
// then it is not handled by default action
}
});