0

On my app, user can download a book.

It gets stored in:

data/data/com.app.app/download/publications/unzipped/Downloaded Book

Inside that Downloaded Book folder, there is "main.css" and "style.css" and "page.html"

Now in webview I want to load like this:

webView.loadDataWithBaseURL("file:///android_asset/",
            """ 
<!DOCTYPE html>        
<html>
<head>
$joinedCss
</head>
<body> 
  $htmlPage
</body>
$jQuery
$js
</html>""", "text/html", "UTF-8", null)

Where $JoinedCss is:

<link rel="stylesheet" href="/data/data/com.app.app/download/publications/unzipped/Downloaded Book/main.css">
<link rel="stylesheet" href="/data/data/com.app.app/download/publications/unzipped/Downloaded Book/style.css"">

Where $htmlPage is:

<div> some stuffs </div>

Where $jQuery and $js is:

var jQuery = "<script type=\"text/javascript\" src=\"js/jquery.min.1.7.js\"></script>"
var js = "<script type=\"text/javascript\" src=\"js/lfn.js\"></script>"

The html loads, but the css not working.

1 Answer 1

0

Try adding those files to your assets folder and updating the href location as answered here. To create/add assets folder see this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.