Use StringEntity class to generate a body which you can attach to the post method.
http://icloud.com/wiki/index.php/A_Android_tutorial_to_get_you_started This example will get you started. Thanks and Regards, Kumar Bibek http://tech-droid.blogspot.com On Mar 29, 3:19 pm, MobDev <developm...@mobilaria.com> wrote: > Hi. > I ahve been trying to send a http POST message towards my server, I > have been using this code : > > HttpClient httpclient = new DefaultHttpClient(); > HttpPost httppost = new HttpPost(sUrl); > > // Add your data > List<NameValuePair> nameValuePairs = new > ArrayList<NameValuePair>(1); > String userAgent = Management.getInstance().getUserAgent(); > nameValuePairs.add(new BasicNameValuePair("User-Agent", > "Test_User_Agent")); > nameValuePairs.add(new BasicNameValuePair("Data", data)); > httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); > > Honestly, to me it all seems overly complicated.... > To start off, how do I actually add a body (for example a custom XML) > to the post ? > Is the nameValuePairs the only option ? I'd like to ismply add a POST > body with data without having to "name" it with a key... > Any help or tips would be greatly appreciated... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.