hi
In a list view i have an webview which should load a image file from the server,when there is no image present i need a dummy image .I tried
holder.imag
@Neeraj is on the right track, but my app allows a refresh of the webview, so I need to clear the error state before any new URL load. Furthermore, the error flag must be stored as a data member on the parent activity so that it persists during onPageStart() and onPageFinish()--those methods can be called after onError().
public class MyActivity extends Activity {
private boolean isError;
...
protected void onResume() {
super.onResume();
isError = false;
myWebView.loadUrl(myUrl);
}
public class MyWebViewClient extends WebViewClient {
/**
* can be called even after error (embedded images?), so error flag must keep state as data-member in activity, cleared by activity before each loadUrl();
*/
@Override
public void onPageFinished(WebView view, String url) {
if (!isError)
showContent();
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
isError = true;
showError();
}