Jak uzyskać adres IP_ADDRESS w formacie IPV4

Próbuję uzyskać adres IP urządzenia, tj. Za pomocą połączenia WIFI lub 3G. Otrzymuję adres IP w formacie IPV6, który nie jest zrozumiały. Chcę w adresie IP w formacie IPV4. Zrobiłem google, ale nie znalazłem żadnych właściwych rozwiązań.

tutaj jest kod, którego używam do uzyskania adresu IP urządzenia

public String getLocalIpAddress() {
    try {
        try {
        for (Enumeration<NetworkInterface> en = NetworkInterface
                .getNetworkInterfaces(); en.hasMoreElements();) {
            NetworkInterface intf = en.nextElement();
            for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) 
            {
                InetAddress inetAddress = enumIpAddr.nextElement();
                System.out.println("ip1--:" + inetAddress);
                System.out.println("ip2--:" + inetAddress.getHostAddress());
                if (!inetAddress.isLoopbackAddress()) {


                    String ip = inetAddress.getHostAddress().toString();
                    System.out.println("ip---::" + ip);
                    EditText tv = (EditText) findViewById(R.id.ipadd);
                    tv.setText(ip);
                    return inetAddress.getHostAddress().toString();

                }
            }
        }
    } catch (Exception ex) {
        Log.e("IP Address", ex.toString());
    }
    return null;
}

Dostaję to wyjście:

ip1--:/fe80::5054:ff:fe12:3456%eth0%2
ip2--:fe80::5054:ff:fe12:3456%eth0

Powinien być wyświetlany w następujący sposób:

192.168.1.1

proszę pomóż mi..

questionAnswers(3)

yourAnswerToTheQuestion