Retrieve IPv6 address for WiFi interface

by IPv6Project » Fri, 20 May 2011 01:26:21 GMT

Sponsored Links
 Dear all !

I am currently developping an application using sockets to communicate
over an IPv6 network.

However I am unable to retrieve the ipv6 address of the WiFi interface

My code works only for IPv4 :(

Is there anyway to adapt this code to retrieve only IPv6 address
(global) of the wifi interface?

Many thanks in advance,

I am using following code:

private String getLocalIpAddress() {
        try {
            for (Enumeration<NetworkInterface> en =
NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
                NetworkInterface intf = en.nextElement();
                for (Enumeration<InetAddress> enumIpAddr =
intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
                    InetAddress inetAddress =
                    if (!inetAddress.isLoopbackAddress()) { return
inetAddress.getHostAddress().toString(); }
        } catch (SocketException ex) {
            Log.e("ServerActivity", ex.toString());
        return null;


Other Threads

1. adb tool connects to real H/W?

I would like to access the Android on the real H/W by the adb tools .
But adb connects to only emulator device(localhost: .
How to connect adb to the external device( through the

Anyone can help me?


2. Button and PopupWindow

Hi to everyone,
I have the following problem..
I have a ListView, and I want this: when a ListItem is selected, a
PopupWindow appears with a button inside. Then I want to be able to
set the button click action.

This is my function:
protected void onListItemClick(ListView l, View v, int position, long
id) {
        super.onListItemClick(l, v, position, id);
        PopupWindow pw = new
        null, true),100,100,true);
               ColorDrawable dw=new ColorDrawable(-65281);


      Button delete= (Button) findViewById(;

      delete.setOnClickListener(new Button.OnClickListener(){
          public void onClick(View v){

The following is scelta.xml:
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="
android:orientation="vertical" android:layout_width="fill_parent"

<Button android:id="@+id/edit"
android:layout_height="wrap_content" />
<Button android:id="@+id/cancella"
android:layout_height="wrap_content" />


The problem is that this code doesn't works, and when I try to debug
it, it seems that it's not possible to find the button. (the button
value is null).
Any suggestion?


3. Scarlett Johansson Shirt Ri

4. Dalvik VM VFY messages

5. Map synch problem

6. Geeting Error in New SDK:- emulator: broken configuration file doesn't have 'window' element

7. How to register application to personally created Home Screen?