Having trouble recasting WifiManager to Object in Android
===

So I am quite new to Android, and have limited previous Java experience, so please bear with me. I am trying to create an object of type WifiManager in an Android App, and I have the line I found several other people recommend to create a WifiManager object verbatum: 

    WifiManager wifi =  mContext.getSystemService(Context.WIFI_SERVICE);

in my program. Now Eclipse has underlined the mContext.GetSystemService etc part with the error **Type mismatch, cannot convert from object to WifiManager**

Now I have tried recasting the return using:

    (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);

This will compile, but results in a **java.lang.NullPointerException** when executed

Any thoughts on this would be greatly appreciated!