更改Android的IP地址/ InetAddress的代码?

时间:2012-01-15 22:46:21

标签: android networking ip

有谁知道更改Android手机的eth0 IP地址(InetAddress)的代码?

(我知道从命令行我可以做ifconfig eth0 new_ip_addr。但我问的是我可以在源代码中添加的内容。)

1 个答案:

答案 0 :(得分:1)

有一个名为NetworkInterface的类,但它可以让你检索iface的数据。我建议使用Runtime.exec("ifconfig".... NetworkInterface -> getDisplayName() and so on )这里有一些关于如何在android环境中编写Runtime.exec()的见解 - Runtime.exec() : Reboot in Android?

相关问题