android HttP請求伺服器,連線超時

2021-07-25 17:51:47 字數 1572 閱讀 9642

@override

public void onclick(view v) 

toast.maketext(getactivity(), "tempurl:" + tempurl,

toast.length_short).show();

url = new url(allfinalinfo.server_url);

for (int i = 0; i < listmsg.size(); i++) 

/* 伺服器返回的響應碼 */

int code = conn.getresponsecode();

if (code == 200) 

// jsonobject jsonobject = new

// jsonobject(responsedata);

// jsonobject succobject =

// jsonobject.getjsonobject("smsbean");

//// //errormsg:表示伺服器執行是否成功的訊息 type:string

// string backmsg =

// succobject.getstring("errormsg");

// //errorcode:0 表示成功 -100表示失敗 type:int

// string backstatus=

// succobject.getstring("errorcode");

// //code 資料庫執行是狀態 0表示成功 -100表示是失敗 type:int

// string dbstatus = succobject.getstring("code");

// //msg:資料庫對於簡訊格式的驗證:是否成功 type:string

// string dbmsg = succobject.getstring("msg");

//// //定義個字串拼接訊息

// stringbuffer buffer=new stringbuffer();

// if(backstatus.equals("0")&&backstatus!=null)else if(dbstatus.equals("0")&&dbstatus!=null)

// toast.maketext(getactivity(),

// buffer,toast.length_short).show();

toast.maketext(getactivity(), "資料提成功",

toast.length_short).show();

looper.loop();

} else 

} catch (malformedurlexception e1)  catch (protocolexception e)  catch (ioexception e)  catch (jsonexception e)  finally 

} catch (ioexception o) }}

}.start();

break;

default:

break;}}

大神,求助,不知道怎麼回事兒就是連線不成功

android http 請求方式

android用 httpclient向伺服器發起get或者post請求 首先client引數設定 可選設定,設定超時 先將引數放入list,再對引數進行url編碼 listparams new linkedlist params.add new basicnamevaluepair param1 ...

Android,HTTP請求中文亂碼

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!編碼引數 listformparams new arraylist 請求引數 建立post請求 android傳送http請求,android預設編碼已是utf 8。問題描述 如上 中已經設定了請求為utf 8,伺服器中編碼也是全部utf 8,可是...

Android HTTP程式設計

例如 http www com china index.html 1 協議名 http 2 全球資訊網伺服器 www 3 裝有網頁伺服器的網域名稱或站點伺服器的名稱 com 4 訪問在伺服器上的路徑 china 5 訪問的內容 index.html url是網際網路上的 資源 的唯一位址標識,它由協...