亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

從 android 應用程序響應時間發送 php 查詢到服務器

從 android 應用程序響應時間發送 php 查詢到服務器

幕布斯7119047 2019-03-19 17:18:32
我想在數據庫中放入一個entry。用的下面的代碼:String url = String.format("http://xxxxxxx/xxx/index.php?home=yes&pid=%s", pid);         // Create a new HttpClient and Post Header         HttpClient httpclient = new DefaultHttpClient();         HttpPost httppost = new HttpPost(url);     try {         ResponseHandler<String> responseHandler = new BasicResponseHandler();         String response = httpclient.execute(httppost, responseHandler);          Log.e("abc", response);         return response;         } catch (ClientProtocolException es)          {                Log.e("x" , es.getMessage());             return "";         } catch (IOException e)          {             Log.e("aasx" , e.getMessage());             return "";         }這段代碼能正常運行,現在當有網絡連接的時候,代碼就會困在httpclient.execute(httppost, responseHandler); 大約倆分鐘。有什么方法可以實現檢查幾秒鐘后,如果沒有反應的就會就catch the exceptions?
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 814 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號