Skip to content

Showing "Page: /" on white page #8

@Xendrez

Description

@Xendrez

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions