|
|
|
Android ช่วยดูโค๊ด มันขึ้น error java.net.socketexception: The operation timed out ครับ |
|
|
|
|
|
|
|
เขียน Code ให้ทำอะไรครับ ?
|
|
|
|
|
Date :
2013-02-21 17:38:05 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
code ส่งค่า พารามิเตอร์ ไป หา server ครับ
Code (Android-Java)
try{
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("empcode",empcode));
params.add(new BasicNameValuePair("sdate",date));
params.add(new BasicNameValuePair("edate",todate));
params.add(new BasicNameValuePair("abs_code",category));
params.add(new BasicNameValuePair("remark",note));
params.add(new BasicNameValuePair("action",action));
params.add(new BasicNameValuePair("username",username));
Log.d("params ask",params.toString());
// getting employee's details by making HTTP request
// Note that employee's details URL will use GET request
JSONObject json = jParser.makeHttpRequest(url, "GET" ,params);
Log.d("json ask",json.toString());
if( json != null){
// check your log for JSON response
int success = json.getInt(TAG_SUCCESS);
//Toast.makeText(getApplicationContext(), "บันทักเรียบร้อย" , Toast.LENGTH_SHORT).show();
Log.d("Single Employee's Details", json.toString());
if (success == 0) {
//successfully received product details
JSONArray reqObj = json.getJSONArray(TAG_ABSENT); // JSON Array
JSONObject reqDetail = reqObj.getJSONObject(0);
strMessage = reqDetail.getString(TAG_MESSAGE).toString();
Toast.makeText(getApplicationContext(), strMessage.toString() , Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(getApplicationContext(), "json is null" , Toast.LENGTH_SHORT).show();
}
}catch(Exception ex){
Toast.makeText(getApplicationContext(), "ex="+ex.getMessage().toString(), Toast.LENGTH_SHORT).show();
ex.printStackTrace();
}
|
|
|
|
|
Date :
2013-02-22 08:49:53 |
By :
rong |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|