Back to project page FxExplorer.
The source code is released under:
Apache License
If you think the Android project FxExplorer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package info.breezes.fxmanager; /*ww w. ja v a 2s .co m*/ import android.content.Context; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import java.net.InetAddress; /** * Created by admin on 2015/1/7. */ public class NetUtils { public static String getLocalIpAddress(Context context) { WifiManager wifiManager = (WifiManager) context.getSystemService(android.content.Context.WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); int ipAddress = wifiInfo.getIpAddress(); return String.format("%d.%d.%d.%d", (ipAddress & 0xff), (ipAddress >> 8 & 0xff), (ipAddress >> 16 & 0xff), (ipAddress >> 24 & 0xff)); } }