|
DoAskTask = new Runnable (){
@ Override
Public void run (){
// TODO
// Perform http request. network request operations here
Ggname = etname. getText (). toString ();
Ggworkid = etworkid. getText (). toString ();
Ggcallid = etcallid. getText (). toString ();
String baseurl = ConfidDatas. askbaseurl;
String askstr = "name =" + ggname + "& callid =" + ggcallid
+ "& Workid =" + ggworkid;
String result = null;
HttpGet httpGet = new HttpGet (baseurl + askstr );
// Step 2: Use the execute method to send an http get request and return the HttpResponse object
HttpResponse httpResponse = null;
Try {
HttpResponse = new defaulthttpclient(cmd.exe cute (httpGet );
} Catch (ClientProtocolException e ){
// TODO Auto-generated catch block
E. printStackTrace ();
} Catch (IOException e ){
// TODO Auto-generated catch block
E. printStackTrace ();
}
Message msg = new Message ();
Bundle data = new Bundle ();
If (httpResponse. getStatusLine (). getStatusCode () = 200 ){
// Step 3: Use the getEntity method to return results.
Try {
Result = EntityUtils. toString (httpResponse. getEntity ());
Data. putString ("value", result );
Data. putString ("result", "isok ");
Msg. setData (data );
Handler. sendMessage (msg );
} Catch (ParseException e ){
// E. printStackTrace ();
} Catch (IOException e ){
// E. printStackTrace ();
}
} Else {// error
Data. putString ("value ","");
Data. putString ("result", "iserr ");
Msg. setData (data );
Handler. sendMessage (msg );
}
}
};
|