I am working on a Android app and I have a dilemma. I have a list of Objects. I have to update each of these objects with a database. I have 2 methods:
Method 1:
I can loop through the Objects. For each object I can connect to the server, update it, and then move on to the next Object, and so forth.
Method 2:
I can store the Objects in a list, send the whole list to the server, update it on the server side, then return a list of updated objects.
My questions are:
- Which method is faster?
- Which method is easier on the phone’s battery?
By the way, Method 1 is easier for me to code :). Thank you.
Method 1: Will take a little longer and utilize more bandwidth and processing power
Reasons:
Method 2: Will generally take less time and tend to utilize less bandwidth and processing power
Reasons: See above 🙂