The async function is useful when you need to return a value from your coroutine. In this video, learn about the use of the Deferred type as well, as the await() function.
- [Instructor] The Async function is useful when…you need to return a value from your coroutine.…So we're going to implement the methods here…in the coroutine's Async test class…in order to try it out.…We're going to first start by using the Async method…the same way that we would use the launch method.…So for that we're going to grab some code…from the coroutine's launch class,…so let's switch over there now.…And we'll grab the code from this first test.…Go back to our test here on line nine and paste that in.…
Let's accept all of our imports.…And the only thing we're going to change is here on line 14.…Instead of using the launch function…we're going to use Async.…So let's go ahead and run the test.…So if we look at our results we're getting…starting, inside and stopping.…The same thing we had before…just like when we were running launch,…except for now we're taking advantage of the Async call.…So now let's look at a better usage of the Async call.…
For that we're going to implement the…usingAsyncWithDeferred test method.…
- What Kotlin has to offer
- Working with lambdas
- Common Android extension functions
- Kotlin Android Extensions overview
- Making use of the Anko library
- Working with coroutines
- Nullability and collections
Skill Level Intermediate
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
Developing AWS Lambda Functions with Kotlinwith Troy Miles1h 55m Intermediate
1. Kotlin Overview
2. Extension Functions and Properties
3. Incorporating Anko
4. Advanced Anko
5. Working with Collections
- 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.