Example usage for android.net LinkProperties getAddresses

List of usage examples for android.net LinkProperties getAddresses

Introduction

In this page you can find the example usage for android.net LinkProperties getAddresses.

Prototype

@UnsupportedAppUsage
public @NonNull List<InetAddress> getAddresses() 

Source Link

Document

Returns all the addresses on this link.

Usage

From source file:com.compal.telephonytest.TelephonyTest.java

private static String formatIpAddresses(LinkProperties prop) {
    if (prop == null)
        return null;
    Iterator<InetAddress> iter = prop.getAddresses().iterator();
    // If there are no entries, return null
    if (!iter.hasNext())
        return null;
    // Concatenate all available addresses, comma separated
    String addresses = "";
    while (iter.hasNext()) {
        addresses += iter.next().getHostAddress();
        if (iter.hasNext())
            addresses += ", ";
    }/*from  w  w w . ja va 2 s .co m*/
    return addresses;
}