You might get a small performance boost from using shouldInterceptRequest
instead of loadDataWithBaseUrl. That won't solve your block size
problem but it will allow WebKit to start parsing your content before
you've finished decompressing the whole thing.
The way you'd use it is:
The way you'd use it is:
class MyWebViewClient extends WebViewClient {
@Override
public WebResourceResponse shouldInterceptRequest (WebView view, String url) {
// this method is *not* called on the UI thread, be careful to not touch UI classes.
if (Uri.parse(url).getHost().equals(Uri.parse("file:///android_asset/..."))) {
// This assumes you pass in the AssetManager to the MyWebViewClient constructor.
InputStream is = assetManager.open(sFileName);
ZipInputStream zipInputStream = new ZipInputStream(is);
return new WebResourceResponse("text/html", "UTF-8", zipInputStream);
}
return super.shouldInterceptRequest(view, url);
}
http://stackoverflow.com/questions/22259773/android-java-reading-file-from-zip-file-into-webview-string-why-zipinputstream
No comments:
Post a Comment