How to feed the IP of the device automatically in android

public String getLocalIpAddress() {
try {
    for (Enumeration en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
        NetworkInterface intf = en.nextElement();
        for (Enumeration enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
            InetAddress inetAddress = enumIpAddr.nextElement();
            if (!inetAddress.isLoopbackAddress()) {
                String ip = inetAddress.getHostAddress();
                Log.i(TAG, "***** IP="+ ip);
                return ip;
            }
        }
    }
} catch (SocketException ex) {
    Log.e(TAG, ex.toString());
}
return null;
}

using getHostAddress : IP=fe70::75ca:a16d:ea5a:.......

using hashCode and Formatter you will get the actual IP.