title: android scan for wifi network
body: <p>i am trying out this code for scanning wifi networks but getting null pointer exception not sure what problem i registered all permission in manifest.</p>
  
  <pre><code>IntentFilter i = new IntentFilter();
      i.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
  
      registerReceiver(new BroadcastReceiver(){
  
              @Override
  
              public void onReceive(Context context, Intent intent) {
                  // TODO Auto-generated method stub
                  Log.i(TAG, "opening wifimanager");
                  WifiManager mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
                  mWifiManager.getScanResults();
  
              }
          }
      ,i);
  
  
  
          mWifiManager.startScan();
  </code></pre>