I've added the lines:
fileOutputStream.write(line.getBytes());
fileOutputStream.close();
after the line:
FileOutputStream fileOutputStream = openFileOutput("index.html", Context.MODE_PRIVATE);
And only see a white page with "Page: /" displaying.
Here's some more context of the code:
webView.setWebChromeClient(new WebChromeClient());
Uri path = Uri.parse(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString() + "Info-1.pdf");//Uri.parse(Environment.getExternalStorageDirectory().toString() + "/data/test.pdf");
try {
InputStream ims = getAssets().open("pdfviewer/index.html");
String line = getStringFromInputStream(ims);
if(line.contains("THE_FILE")) {
line = line.replace("THE_FILE", path.toString());
FileOutputStream fileOutputStream = openFileOutput("index.html", Context.MODE_PRIVATE);
fileOutputStream.write(line.getBytes());
fileOutputStream.close();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
webView.loadUrl("file://" + getFilesDir() + "/index.html");
I don't understand what I'm doing wrong.
I've added the lines:
after the line:
And only see a white page with "Page: /" displaying.
Here's some more context of the code:
I don't understand what I'm doing wrong.