I’m new in android and i’m trying to make an android app to display a database. The database is stored in a server, and i want to comunicate with the server through http requests.
I already have the connection established, and i can send small pieces of data with post and get, using an URLBuilder to fetch all fields, but now i want to send all data from the server to my android app.
Since the data i’m sending is a List of Objects, i don’t know which is the best way to send this information to the android app.
Can anyone help?
I’m new in android and i’m trying to make an android app to display
Share
You can convert data on server to some text format, e.g. JSON and return it in http response. On client you construct objects back from JSON using JSONArray and JSONObject.
E.g. you have following class:
Persons are John Smit and Jack Brown. JSON may look like:
You return it in response and on client do following:
Advantage of this way: you can easily debug and control which data is sending to client.
Disadvantage: you need to convert/parse from JSON and it requires additional time.