Retrofit and Coroutines

The old way of making network calls with Retrofit utilizes callbacks. In this course, learn how to greatly simplify Android networking code with an app that retrieves and displays a list of GitHub repositories. By Fuad Kamal.

2.2 (27) · 1 Review

Save for later
Comments
Share

Learning path

This is part of the Advanced Android Data & Networking learning path. View path.

Who is this for?

Developers who want to use the modern approach of writing asynchronous network calls. It expects you to be familiar with Android Studio and Kotlin programming. Familiarity with Retrofit would be helpful but is not required.

Covered concepts

  • Retrofit networking library
  • Using coroutines with Retrofit to make network calls.
  • Converting callback style code to coroutines

Part 1: Retrofit

01
Toggle description

Review retrofit and what related libraries can be used for data conversion. Then, add the necessary dependancies to the Gradle and synchronize the project.

Toggle description

Set up an interface that lets Retrofit connect to the GitHub API.

Toggle description

Create a class to implement the Github service and use it to fetch data.

Toggle description

Make a retrofit network call the old way using callbacks.

Part 2: Coroutines

Toggle description

Learn how coroutines make asynchronous code read like synchronous code. Understand how coroutines handle threading for you and coroutine scope.

Toggle description

Update the traditional Retrofit code from the previous episode to instead use coroutines.

Up next

Android & Kotlin
Image Handling with Picasso
Learn how to use one of the most popular Android libraries: Picasso. See why Picasso is so popular and how... more

Instructors

Contributors

Fuad Kamal

Instructor

Adriana Kutenko

Illustrator

Over 300 content creators. Join our team.