문제

I have a task that sounds simple, but I have not yet figured out how to do it. I have a URL in my Android App. Now I want to download it, save it on my device, and then load it into a webview (let's say it is an image). I have to load my file from the device itself, so I cannot just load my image into my webview.

And the image has to be stored permanently. So that I can reopen it after closing the app even without internet connection.

I know how to work with Assets, but I cannot store files there that I am downloading during runtime, if I got this right.

도움이 되었습니까?

해결책

If you are saving file in an html format on sd card you can load it in web view as shown below

webView.loadUrl("file://"+Environment.getExternalStorageDirectory()+"/filename.html");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top