Java tutorial
//package com.java2s; import android.content.Context; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; public class Main { public static int getIpAddressInt(Context context) { WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (wifiManager == null) return 0; WifiInfo info = wifiManager.getConnectionInfo(); return info == null ? 0 : info.getIpAddress(); } public static String getIpAddress(Context context) { int ipAddress = getIpAddressInt(context); return String.format("%d.%d.%d.%d", (ipAddress & 0xff), (ipAddress >> 8 & 0xff), (ipAddress >> 16 & 0xff), (ipAddress >> 24 & 0xff)); } }