In my ContentView I have some offline content and also one WebView. When device is online, WebView shows the content from the web. But when device is offline, white page is shown instead. How can I get rid of this blank page? I would like not to display any WebView content in offline mode.
My code is:
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
android.net.NetworkInfo wifi = cm
.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
android.net.NetworkInfo datac = cm
.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if ((wifi != null & datac != null)
&& (wifi.isConnected() | datac.isConnected())) {
android.webkit.WebView wv =
(android.webkit.WebView)this.findViewById(R.id.myWebView);
wv.clearCache(true);
wv.loadUrl("MyURL");
wv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
wv.getSettings().setJavaScriptEnabled(true);
}