coolbud012

CheckInternetConnection

Jan 31st, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. private void checkInternetConnection() {
  2. ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
  3. NetworkInfo netInfo = connMgr.getActiveNetworkInfo();
  4. if(netInfo != null && netInfo.isConnected()) {
  5. getJsonData();
  6.  
  7. } else {
  8. CheckInternetDialog checkInternetDialog = new CheckInternetDialog();
  9. checkInternetDialog.show(getSupportFragmentManager(), "checkInternetConnection");
  10. }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment