I want to read pdf 开发者_如何学Gofile from url in the android emulator.
I have done the following, but it is not working
WebView web1 =(WebView)findViewById(R.id.webview);
web1.getSettings().setJavaScriptEnabled(true);
web1.loadUrl("http://docs.google.com/viewer?url=http%3A%2F%2Fwww.cranialtech.com%2Fimages%2Fstories%2FFiles%2Fpositioningprotocol.pdf");
and
Uri path = Uri.parse("http://docs.google.com/viewer?url=http%3A%2F%2Fwww.cranialtech.com%2Fimages%2Fstories%2FFiles%2Fpositioningprotocol.pdf");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf"); //Set data type
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try
{
startActivity(intent);
}
catch (ActivityNotFoundException e)
{
Toast.makeText(this," pdf not found",
Toast.LENGTH_SHORT).show();
}
But it is still not working.
please help me
thanks in advance.
try this code ::
WebView web1 =(WebView)findViewById(R.id.webview);
web1.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=http://docs.google.com/viewer?url=http%3A%2F%2Fwww.cranialtech.com%2Fimages%2Fstories%2FFiles%2Fpositioningprotocol.pdf");
精彩评论