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


Other Threads

1. Howto get string /dev/block/vold/179:1 ( sdcard device) in an android app

Hi:

Anyone knows if there is any way to get the device path of the SDCARD?
I have mounted /dev/block/vold/179:1 on /mnt/sdcard and type is vfat.
My app runs ok cause I'm runnin the command "mount |grep sdcard |grep
vfat |  awk  -F" " '{print $1}' and get corresponding "/dev/block/vold/
179:1. But, what happens if other users have sdcard filesystem with
ext2, ext4, etc,,,? The app will not run correctly. The solution may
be change the command I've wrote below by other that can get directly
the string referent to the sdcard device.

Please, help me and If you can tell me a good reference for these
topics I will be grateful.

Thanks.

-- 

2. Disable autosuggest/correct

I have an edittext where i want the user to have the choice to turn
off the autosuggest when typing. I tried to change the inputType but
it only changed the edittext to singel line edittext which I don't
want even when I included
android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE.
Any suggestions of how to do that?

//Andr

-- 

3. Tabs On Sense Devices

4. === My ContentProvider.query() can not populate a Cursor. ===

5. Read files to edittext

6. GPS System in Jeopardy(!?)

7. Peer to Peer Streaming Protocol on Android ?