Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( !isNetworkAvailable() ) { // loading offline
- main_webView.getSettings().setCacheMode( WebSettings.LOAD_CACHE_ELSE_NETWORK );
- }
- // WebView main_webView;
- main_webView = (WebView) findViewById(R.id.webView);
- main_webView.setWebViewClient(new MyWebViewClient());
- main_webView.loadUrl("http://www.lialpa.org/CM3/app.html");
- //end of webview setup
- private boolean isNetworkAvailable() {
- ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService( CONNECTIVITY_SERVICE );
- NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
- return activeNetworkInfo != null && activeNetworkInfo.isConnected();
- }
Add Comment
Please, Sign In to add comment