checkStaticIP
.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
android.provider.Settings.System.putInt(
contentResolver, ETHERNET_USE_STATIC_IP,
isChecked ? 1 : 0);
}
});
// GET static IP
editIPAddress = (EditText) findViewById(R.id.editIPAddress);
editIPAddress.setText(Settings.System.getString(contentResolver,
ETHERNET_STATIC_IP));
// GET static gateway
editGateway = (EditText) findViewById(R.id.editGateway);
editGateway.setText(Settings.System.getString(contentResolver,
ETHERNET_STATIC_GATEWAY));
// GET static netmask
editNetmask = (EditText) findViewById(R.id.editNetmask);
editNetmask.setText(Settings.System.getString(contentResolver,
ETHERNET_STATIC_NETMASK));
// GET static

这篇博客介绍了如何在Android设备上使用静态IP配置以太网。通过设置系统的相关参数,包括IP地址、网关、子网掩码和DNS,并提供了检查以太网状态和IP地址有效性的方法。
最低0.47元/天 解锁文章
1220

被折叠的 条评论
为什么被折叠?



