How to send an object of custom class from Android to Java Server?

629 views Asked by At

I have created several classes in android client application corresponding to each database table (just like concept of Entity-Objects).

i want to retrieve data from database of the server to android client application and then assign that returned data set to objects of those created classes to further process the data and apply some logic.

I also want send data from android to server in the form of objects to process them on server or insert/update in the database.

(I can send the data to Servlet using HttpClient and HttpPost but don't know how to send objects and how to receive result set of database in the form of objects).

I'm new to client-server programming so my this approach might be wrong, if so then please correct me. any sample code will be appreciated.

1

There are 1 answers

6
Tim On

normally you would send some kind of String to the server which represents your Object. You could do that by generating JSON. There are nice libraries like GSON which can help you with that