A snippet for what I do...
public HttpResponse updateGirl(String url, Pawn girl, int pawnID) {
HttpClient httpclient = new DefaultHttpClient();
HttpPut httpput = new HttpPut(url);

// Execute the request

try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(
39);
nameValuePairs.add(new BasicNameValuePair("id", Integer
.toString(pawnID)));
......  Many nameValuePairs later.....


httpput.addHeader("Content-Type",
"application/x-www-form-urlencoded");
httpput.setEntity(new UrlEncodedFormEntity(nameValuePairs,
HTTP.UTF_8));
 HttpResponse response = httpclient.execute(httpput);
return response;

} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;

}

Hope that helps.   I struggled with it for a couple of weeks before I found
a site that had a good source.



On Tue, Sep 8, 2009 at 6:18 AM, Alok Kulkarni <[email protected]> wrote:

> Any answers ??
>
>
> On Tue, Sep 8, 2009 at 2:00 PM, Alok <[email protected]> wrote:
>
>>
>> I have created a JSON object which i want to send over the network to
>> a server.Do i need to user OutputStream and BufferedOutput stream ?
>> I have read the RestClient example which parses an incoming JSON
>> object and retrieves the string data. But how do i send a JSON object
>> to the server?
>> Thanks,
>> Alok
>>
>>
>
> >
>


-- 
Writing code is one of few things
that teaches me I don't know everything.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to