I don't think this is a duplicate, but this question may be relevant.
As of title: this works perfectly on android 2.3.3, randomly shows a blank page on 4.0.1. It usually works at first, then start displaying blank pages until the application is reinstalled.
The code I'm using to display a simple (html only) webpage is a follows:
@Override
public void afterTextChanged(final Editable arg0){
final String result = getResult();
final String base64 = encode(result);
//This is the WebView
results.loadData(base64, "text/html; charset=utf-8", "base64");
}
private String encode(final String value){
try{
final byte[] bytes = value.getBytes("UTF-8");
final String base64 = Base64.encodeToString(bytes,
android.util.Base64.DEFAULT);
return base64;
}
catch(UnsupportedEncodingException e){
return "YOULOOZE";
}
}