如果互联网网络较低,服务器端响应时间超过1分钟,我需要显示一个对话框。如何完成这项任务。 我正在使用下面的代码。 但它不工作故意.:Android:等待服务器响应一分钟,否则显示警告对话框
try
{
HttpConnectionParams.setConnectionTimeout(hc.getParams(),60000);
int timeoutSocket = 60*1000;
HttpConnectionParams.setSoTimeout(hc.getParams(), timeoutSocket);
}
catch(ConnectTimeoutException e){
//System.out.println(e);
m_Progress.cancel();
alertDialog = new AlertDialog.Builder(AdminEbooks.this).create();
//alertDialog.setTitle("Reset...");
// System.out.println("internet not available");
alertDialog.setMessage("Low internet connectivity?");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
alertDialog.cancel();
}
});
}
我检查这一点,也没有工作..它只是显示一个黑色的屏幕没有别的:( – ekjyot
哎neetesh其工作,但u能PLZ告诉我的其他因为当我的w/s进度dailog运行,然后我得到两个日志从w/s。1)为我的登录响应和2)形式URL url = new URL(“http:// ....... ..........“);所以我的w/s检查Url两次,并显示日志两次。 – Google