Android - synchronize all

I have to implement a “synchronize”-button in an Android app such that when pressing the button the local data is synchronized with a server. I (a beginner in this field) have to access a REST-Interface to send new data, which was generated on the app and request new data to update the local database with data from the server. The app should monitor for each database table - synchronization if something went wrong (esp. when sending data to the server-db) and immediately stop if so. The problem is that Android does not allow sending data over the network on the UI-thread so i can't just simply implement a loop there.
1 answer

This one is the BEST answer!

I used Retrofit for the REST part. Retrofit allows to perform a REST-call asynchronously. Do develop the one-at-a-time synchronization approach for the tables I packed every asynchronous call into an Executor Service, which supports the detection of finished threads. As a result I could detect for every local table if the synchronization succeeded.