在开发 android 应用程序时,使用以下代码时出现错误“对不起,我们无法在原始来源找到文档”:请告知
@Override
public boolean shouldOverrideUrlLoading( WebView view, String url ) {
if (url.contains(".pdf")){
Toast.makeText(view.getContext(), "chand", Toast.LENGTH_LONG).show();
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), "application/pdf");
view.getContext().startActivity(intent);
//String googleDocs = "http://docs.google.com/gview?embedded=true&url=";
//view.loadUrl(googleDocs + url);
//Toast.makeText(view.getContext(), "chand", Toast.LENGTH_LONG).show();
//String pdfurl = "http://docs.google.com/gview?embedded=true&url=" + url;
//Log.i(TAG, "Opening PDF: " + url);
//view.getSettings().setJavaScriptEnabled(true);
//view.loadUrl(pdfurl);
}
return false;
}