 disabled both Wi-Fi and mobile data access. 
For more discussion of this topic, see the lesson <a
href="../../../training/basics/network-ops/managing.html">Managing Network
Usage</a>.</p>

<pre>
public void myClickHandler(View view) {
    ...
    ConnectivityManager connMgr = (ConnectivityManager) 
        getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
    if (networkInfo != null &amp;&amp; networkInfo.isConnected()) {
        // fetch data
   