简体   繁体   中英

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM