android - how to get two diffrent url in backgound task -
below code have 1 url in backgroundtask , string on postexecute in senario have 2 http connection do? please me url1 , url2 hwo both work onbackground parrllel????
public class thetask extends asynctask<void, string, string> { @override protected void onpreexecute() { super.onpreexecute(); } @override protected string doinbackground(void... arg0) { try { string query = urlencoder.encode("american%20cheese%20burger", "utf-8"); string url = "http://198.57.208.46/xyz"; log.i("url",""+url); httpclient client = new defaulthttpclient(); httpget request = new httpget(url); httpresponse response = client.execute(request); httpentity resentity = response.getentity(); _response=entityutils.tostring(resentity); }catch(exception e) { e.printstacktrace(); } return _response; } @override protected void onpostexecute(string result) { super.onpostexecute(result); tv.settext(result); } } } have 1 more http connection , on postexecute parallel?? protected void onpostexecute(string result,string result2) string url2 = "http://198.57.208.46/abc"; log.i("url",""+url); httpclient client = new defaulthttpclient(); httpget request = new httpget(url); httpresponse response = client.execute(request); httpentity resentity = response.getentity(); _response=entityutils.tostring(resentity);
Comments
Post a Comment