In last week’s tip, David described how to use the open-source library Retrofit to make web service calls. In recent versions of Android, you have to make these calls asynchronously. David solved that requirement last week by wrapping the call in an AsyncTask object. But Retrofit actually has tools you can use to make the call asynchronously without an AsyncTask, an IntentService, or other sort of separate structure.
- [Instructor] In last week's tip,…I described how to use the open source library Retrofit…to make web service calls.…In recent versions of Android,…you have to make these calls asynchronously.…I solved that challenge last week by creating an AsyncTask…that receives the request, executes the web service call…in the background and then handles the response…in the onPostExecute method,…which is executed in the main thread.…But Retrofit actually has tools you can use…to make the calls asynchronously without an AsyncTask,…an IntentService or any other sort of separate structure.…
Let's start with the web service.…The web service call doesn't change at all.…You still create a Retrofit object that's accessible…from outside the class and then you define your call…using a get or a post annotation.…In this example, I'm using a get request…to retrieve all data items from the JSON feed.…In my current code, I've wrapped the request…inside the web service task, AsyncTask class.…When I call the execute method,…that results in a synchronous call…
Skill Level Intermediate
Q: Why can't I earn a Certificate of Completion for this course?
A: We publish a new tutorial or tutorials for this course on a regular basis. We are unable to offer a Certificate of Completion because it is an ever-evolving course that is not designed to be completed. Check back often for new movies.
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
Building Android Apps with Cloud Serviceswith Albert Lo2h 37m Intermediate
1. Android Development Tips Weekly
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.