I'm trying numerous ways to open the Downloads folder of the user and allowing the user to ONLY select a doc or pdf file to open up. Majority of the methods out there have been deprecated and their alternatives just don't seem to work for me.
Current Code:
// I've heavily altered the code but hope you guys understand the gist of it.
//Steps:
// Open the Downloads folder
// Let user select the pdf or docx.
// Open the doc or pdf.
// Adding Syllabus Function Method Here.
addSyllabus = findViewById(R.id.add_syllabus_button);
addSyllabus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
webview = (WebView) findViewById(R.id.webView);
progressbar = (ProgressBar) findViewById(R.id.progressBar);
webview.getSettings().setJavaScriptEnabled(true);
String filename = "https://s25.q4cdn.com/967830246/files/doc_downloads/test.pdf";
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=" + filename);
webview.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
// do your stuff here
progressbar.setVisibility(View.GONE);
}
});
}
});
Appreciate it, thanks.