Q:

how to send and get object using httpurlconnection? 

how can I send an object of a class as post using HttpUrlconnection and again get it from sever ?  what should i do to implementing Serializable?  and is any way to send list of objects ?! 
Thanks  

A:

First you need to call these:
conn.setDoOutput(true); // enable write. 
conn.setDoInput(true); // enable read. 

For sending data ( data must implement Serializable ) :
ObjectOutputStream out = new ObjectOutputStream( conn.getOutputStream() );
out.writeObject( data );
out.close();

For receiving data:
ObjectInputStream ois = new ObjectInputStream( conn.getInputStream() );
data = ois.readObject();
ois.close();

