title: networkInfo.isConnected() error
body: <p>I'm receiving an error when executing this code.</p>
  
  <p>When connected to wifi, the function should display MAC address,  otherwise "---"</p>
  
  <pre><code>private void DisplayWifiStatus() {
  
      ConnectivityManager conMgr = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
      NetworkInfo networkInfo = conMgr.getActiveNetworkInfo();
      wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
      WifiInfo info = wifi.getConnectionInfo();
  
      if (networkInfo.isConnected()) {
          textMac.setText(info.getMacAddress());
  
      }else {
          textMac.setText("-----");
      }
  }
  </code></pre>
  
  <p><strong>Logcat/Stacktrace:</strong></p>
  
  <pre><code>03-11 21:32:07.532    3348-3348/com.light87sakurahimegmail.wifiscanner E/dalvikvm﹕ &gt;&gt;&gt;&gt;&gt; Normal User
  03-11 21:32:07.532    3348-3348/com.light87sakurahimegmail.wifiscanner E/dalvikvm﹕ &gt;&gt;&gt;&gt;&gt; com.light87sakurahimegmail.wifiscanner [ userId:0 | appId:10337 ]
  03-11 21:32:07.782    3348-3348/com.light87sakurahimegmail.wifiscanner E/AndroidRuntime﹕ FATAL EXCEPTION: main
      Process: com.light87sakurahimegmail.wifiscanner, PID: 3348
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.light87sakurahimegmail.wifiscanner/com.light87sakurahimegmail.wifiscanner.MainActivity}: java.lang.NullPointerException
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350)
              at android.app.ActivityThread.access$800(ActivityThread.java:163)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:157)
              at android.app.ActivityThread.main(ActivityThread.java:5335)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
              at dalvik.system.NativeStart.main(Native Method)
       Caused by: java.lang.NullPointerException
              at com.light87sakurahimegmail.wifiscanner.MainActivity.DisplayWifiStatus(MainActivity.java:79)
              at com.light87sakurahimegmail.wifiscanner.MainActivity.onCreate(MainActivity.java:43)
              at android.app.Activity.performCreate(Activity.java:5389)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2256)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350)
              at android.app.ActivityThread.access$800(ActivityThread.java:163)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:157)
              at android.app.ActivityThread.main(ActivityThread.java:5335)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
              at dalvik.system.NativeStart.main(Native Method)
  </code></pre>