Getting error while doing api call and android app is crash -


i new android, m trying api call php , have done 1 example it, work on computer fine same app package gives error in eclipse on laptop.

public void postdata() {     // create new httpclient , post header     httpclient httpclient = new defaulthttpclient();     httppost httppost = new httppost("http://www.yoursite.com/script.php");      try {         // add data         list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(2);         namevaluepairs.add(new basicnamevaluepair("id", "12345"));         namevaluepairs.add(new basicnamevaluepair("stringdata", "hi"));         httppost.setentity(new urlencodedformentity(namevaluepairs));          // execute http post request         httpresponse response = httpclient.execute(httppost);      } catch (clientprotocolexception e) {         // todo auto-generated catch block     } catch (ioexception e) {         // todo auto-generated catch block     } } `  

hear error log, got of errors.

//try following way     //list<namevaluepair> namevaluepairs  httpclient hc = new defaulthttpclient(); httppost hp = new httppost(url); urlencodedformentity obj=new urlencodedformentity(namevaluepairs); obj.setchunked(true); hp.setentity(obj); httpresponse hr = hc.execute(hp);    httpentity = hr.getentity();  

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -