view plaincopy to clipboardprint?

  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()) {

  return inetAddress.getHostAddress().toString();

  }

  }

  }

  } catch (SocketException ex) {

  Log.e(LOG_TAG, ex.toString());

  }

  return null;

  }

  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()) {

return inetAddress.getHostAddress().toString();

  }

  }

  }

  } catch (SocketException ex) {

  Log.e(LOG_TAG, ex.toString());

  }

  return null;

  }

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. android中SELINUX规则分析和语法简介
  2. android 1.6中LinearLayout getBaseline
  3. android UI进阶之style和theme的使用
  4. 图文并茂的android之SpannableString
  5. 使用谷歌提供的支持库(Android)
  6. android之图像处理、缩放、修改图片、绘
  7. 在eclipse中查看android源码
  8. android设置Activity背景色为透明的3种方
  9. android Java开发设计模式及在android中
  10. Android中关于Volley的使用(一)加载图片