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.

Ibccx
  • 105
  • 3
  • 11

1 Answers1

0

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

Landon
  • 26
  • 4