Android getWifiState to String
Posted
by ahsteele
on Stack Overflow
See other posts from Stack Overflow
or by ahsteele
Published on 2010-05-31T20:17:26Z
Indexed on
2010/05/31
20:23 UTC
Read the original article
Hit count: 405
I am attempting to get the string representation of an Android device's current WiFi state. I am using the getWifiState()
method of the WiFiManager
and am getting an integer returned depending on the current state. This makes total sense as getWifiState()
is supposed to return an integer. The method's documentation indicates that the possible return values translate to one of the following constant values
- 0 WIFI_STATE_DISABLING
- 1 WIFI_STATE_DISABLED
- 2 WIFI_STATE_ENABLING
- 3 WIFI_STATE_ENABLED
- 4 WIFI_STATE_UNKNOWN
Is there an easy way to translate the integer returned from getWiFiState()
to a string representation? I've looked at getIntExtra
but am unsure of its use.
© Stack Overflow or respective owner