我想在检查 Internet 状态后更改 imageview 图像。基本的,如果我想显示某个图像,我想检查互联网是否正常工作。
这是我的代码:
public void onClick(View v) {
// get Internet status
isInternetPresent = cd.isConnectingToInternet();
// check for Internet status
if (isInternetPresent) {
// Internet Connection is Present
// make HTTP requests
showAlertDialog(AndroidDetectInternetConnectionActivity.this, "Internet Connection", "You have internet connection", true);
} else {
// Internet connection is not present
// Ask user to connect to Internet
showAlertDialog(AndroidDetectInternetConnectionActivity.this, "No Internet Connection", "You don't have internet connection.", false);
}
}