title: How can I use WifiManager in a non-activity class?
body: <p>I have two classes: one of these is an activity class and the other is non-activity. And I call a method which is inside the non-activity class for returning mac Adress.</p>
  
  <p>activity class:</p>
  
  <pre><code>public class Control extends Activity {
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      deneme d = new deneme(this); // i has tried (getApplicatonContext)
      String x = d.macadress();
      Toast.makeText(getApplicationContext(), x, Toast.LENGTH_LONG).show();
  }}
  </code></pre>
  
  <p>and non-activity class:</p>
  
  <pre><code>public class deneme {
  Context mcontext ;
  WifiManager wm;
  
  public deneme(Context mcontext){
      this.mcontext = mcontext;
  }
  
  public String macadress(){
      wm = (WifiManager)mcontext.getSystemService(Context.WIFI_SERVICE);
      String m_szWLANMAC = wm.getConnectionInfo().getMacAddress();
      return m_szWLANMAC;
  
  }}
  </code></pre>
  
  <p>but the method return null. I have the permission ACCESS_WIFI_STATE.</p>