Skip to content

Instantly share code, notes, and snippets.

@julianshen
Created October 21, 2011 19:02
Show Gist options
  • Save julianshen/1304648 to your computer and use it in GitHub Desktop.
Save julianshen/1304648 to your computer and use it in GitHub Desktop.
@Override
public WebResourceResponse shouldInterceptRequest(WebView view,
String url) {
if(url.startsWith("asset://")) {
String fileName = url.substring(8);
try {
WebResourceResponse resp = new WebResourceResponse("text/javascript", "UTF-8", MyActivity.this.getAssets().open(fileName));
return resp;
} catch (IOException e) {
e.printStackTrace();
}
}
return super.shouldInterceptRequest(view, url);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment