last day (15 days later) » 

11:49
0
Q: Android WebView load html from internal storage

GunaseelanUpdate Actually my requirement is I want to load dynamic files into Webpage like image. video, audio etc.., it's either from asset or apps own files directory, that's not a problem. Here is my updated html, <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <

post your manifest.
Try to uninstall app and install again.
"file:////data...... That should be "file:///data....
Check if you can load a file from getExternalFilesDir() instead.
Hmmmm.. its time i check some code under 30..
@PratikButani I have updated the question. Please take a look.
src="file:////.............. That really should be src="file:///...... Please change your code as it is not nice seeing wrong code all the time.
it's either from asset or somewhere else, that's not a problem. Well that code loads not from assets. You could put three img tags in that html. With one that loads from assets. One from getFilesDir() and one from getExternalFilesDir(). Then you cover much more.
@blackapps, If I mention it as file:/// then it doesn't load even in 29. Actually I am also get it from some SO post only.
11:49
But.... the whole problem starts already if you tell the webview to load a html file from /data/user/0/com.guna.testapplication/files/Home.html The webview will not load then. So that is all. You dont have to talk about images and dynamic content. The html is not loaded to begin with! Very simple question would that be.
How did you place that html file in /data/user/0/com.guna.testapplication/files ? Add code like new File( ...path ..).exists() before you call loadUrl.
Put the used code in your post. I have no idea what you did. You should understand that. AND How did you place that html file in /data/user/0/com.guna.testapplication/files ?
@blackapps, finally I have updated full code of MainActivity, including copy, loading from filesdir, loading from assets, Is that enough?
Eh... i was just starting to test this on 30 and indeed html does not load. But on 29 it does not load either... so it puzzles me... But... where is the code that you check if thye file exists before you call loadUrl?
Look into copyRelatedAssets -> if (file.exists()) {
12:11
@blackapps, I found the answer, and has updated, please take a look.
@PratikButani I found the answer, and has updated as Answer to the question, take a look.

last day (15 days later) »