The constructor WifiInfo() is not visible

by Flappie » Mon, 03 Nov 2008 13:40:08 GMT


Sponsored Links
 Yes i know.....i'm a newbie.
But i'm currently learning the syntax of android using Eclipse.
I'm trying to get the network SSID and just through it to the
log.....for learning purpose i would say.
this is my part code:

WifiInfo checkx = new WifiInfo();
android.util.Log.v("sometag","SSID= " + checkx.getSSID());

I get a error on the "new WifiInfo()" part.
Saying: "The constructor WifiInfo() is not visible"
Why can't it find/see the contructor of this Class?

It's comming from:
namespace: android.net.wifi.WifiInfo;

I know...i'm a newbie but i've got to start somewhere.......

--~--~---------~--~----~------------~-------~--~----~



The constructor WifiInfo() is not visible

by Jason Parekh » Mon, 03 Nov 2008 14:06:01 GMT


 hey Flappie,

The WifiInfo constructor isn't public as it's not meant to be instantiated
by clients.  Instead, you retrieve it from WifiManager's getConnectionInfo.
You can get a reference to WifiManager by using
context.getSystemService(Context.WIFI_SERVICE) (and casting it).

For more info, check out:
 http://code.google.com/android/reference/android/net/wifi/WifiManager.html 

jason






--~--~---------~--~----~------------~-------~--~----~


Sponsored Links