add that in .class file and use in MainActivity.java 
how to create check NetworkConnectionStatus in class file and use in mainactivity

```

Private void checkNetworkConnectionStatus()   {
        boolean wifiConnected;
        boolean mobileConnected;
        ConnectivityManager connMgr = (ConnectivityManager)
                getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeInfo = connMgr.getActiveNetworkInfo();
        if (activeInfo != null && activeInfo.isConnected()){ //connected with either mobile or wifi
            wifiConnected = activeInfo.getType() == ConnectivityManager.TYPE_WIFI;
            mobileConnected = activeInfo.getType() == ConnectivityManager.TYPE_MOBILE;
            if (wifiConnected){ //wifi connected

            }
            else if (mobileConnected){ //mobile data connected

            }
        }
        else { //no internet connection

        }
    }

```