I have a page that contains a listView and each item is supposed to open a pdf file from a url, but I don\'t know how to load a pdf file from a url or even how to load a pdf
WebView webview1 = (WebView) findViewById(R.id.webview1);
webview.getSettings().setJavaScriptEnabled(true);
String filename = "http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_parameters.pdf";
String filename1 = "http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_parameters1.pdf";
possible duplicate : Android : How to Load PDF?
pass separate seperate URl on
ListView lt = (ListView) findViewById(R.id.listview);
lt.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
if (arg2 == 1) {
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=" + filename);
}
if (arg2 == 2) {
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=" + filename1);
}
}
});
You can try browser to open pdf file in that like below code:
http://docs.google.com/gview?embedded=true&url=yoururl
where yoururl will be your pdf url link.