Code example for ConnectivityManager

Methods: setMobileDataEnabled

0
                .getSystemService(Context.CONNECTIVITY_SERVICE);
 
        if (enabled) {
            cm.setMobileDataEnabled(false);
        } else { 
        	cm.setMobileDataEnabled(true);
 
        } 
    } 
 
} 
Connect your IDE to all the code out there  Get Codota for Java