How to open pdf file from server without saving it on device and without using any third party application.because i don\'t want my user to download any application to use my ap
This method worked in the older versions of android:
In a new activity:
WebView webview = new WebView(this);
setContentView(webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=URL_of_PDF/fileName.pdf");
setContentView(webview);
give internet
permission in manifest file.
USE the following method to open a PDF file with already installed 3rd party application.
To open the PDF in application use:
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);