Anko provides a couple of functions that you can use to make working with coroutines on Android easier. In this video, take a look at the bg() function and how you can use it to handle background tasks.
- [Instructor] Anko provides us with a couple…of functions that we can use to…make working with coroutines on android easier.…Let's take a look at the most useful one.…First, we need to make sure our built out gradle file…has the anko coroutine dependency,…just like you see here on line 39.…So now we can go ahead and update our activity…to take advantage of our function BG.…So let's switch over there now, and here on line 27,…this is where we grab our list of planets…and then we populate it in our adaptor.…
We're just going to comment this out for now.…And we're going to reference a new function,…which we're going to call get planets time consuming.…And this is basically just to simulate…that we're executing a long running network call.…So let's go ahead and use alt enter to create this function.…And we'll delete the template contents.…Now the first thing we want to do is…to start our coroutine using the launch function.…
And for our coroutine context, we're going to provide…the UI coroutine context because…this executes on androids main UI thread.…
- 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.