Yup. Still massively confused. I tried pausing it and slowing it down and watching it multiple times. You go REALLY fast. I think one of the things that is so confusing about these things is the fact that there are multiple ways to do them so it seems like every example is a little different adding to the confusion.
When you want to explain one idea, try to make the surrounding ideas as simple as possible. Here rather than concentrating on callback we start following that many classes that call each others. Thank you for tutorial.
Really liked the way that you explained. But it would be really cool if you also had a git link for the code. I was stuck with async programming for a month, posted question in stack yet everyone was going for coroutines asking me to suspend a function until it gets a result back? I quite didn't get that either.
I'm glad it helped you! I just uploaded the source code here: github.com/jacobklewis/Scratch-Notes/blob/master/src/main/kotlin/me/jacoblewis/callbacks/Callbacks.kt I will likely create a video on coroutines later; in fact, I actually prefer coroutines. However that was outside of the scope for this video. Message me if you have more questions!
How would compatibility between Kotlin and java work for lamba ? For eg , invoke the callback through a kotlin file but it passes down to a java file which ultimately needs to implement this callback
How is delay accepting another argument? delay(type.brewTime){ val madeCoffee = Coffee(type) callback.onCoffeeBrewed(madeCoffee) } Why is this not giving error? I am trying to fetch API data and show in the TextView. Where do I put the reference to callback function? I am using simple HttpURLConnection and InputStream to fetch the data.
The delay function here is a custom function to simulate something like a network request. It might be confusing if you're familiar with coroutines because there is a delay function here as well. You could replace this with an async network request. The async network request will likely have it's own type of closure, however this is dependent on the framework used. Are you building something for Android or only the JVM?
@@kotlinbytes95 i am building for android. can you provide the source code you showed in the video? I dont know where to put the reference to the callback function.
Cheenu soni, Here is a simple network library that I recently published to GitHub: github.com/jacobklewis/Simple-Network Look at the README for details on how to use. It utilizes the built in HttpsURLConnection classes that are provided with Android. Feel free to use this code in any way you'd like. Note that HttpsURLConnection is a "blocking" network library (it will make the UI freeze), so it needs to be wrapped in something that will execute it on an IO thread. This library handles that for you. Here is the direct library source code: github.com/jacobklewis/Simple-Network/tree/master/network/src/main/java/me/jacoblewis/network If you are open to other libraries, here are a few other considerations: OkHttp: github.com/square/okhttp Retrofit: square.github.io/retrofit/
Thanks man! I couldn't understand it in my native language (Russian). Your explanation made it clear.
Having the code (as in a git repo) would be much appreciated, might make it a bit easier to follow! Great video nonetheless!!
That's an excellent idea! I'll do this for newer videos.
Yup. Still massively confused. I tried pausing it and slowing it down and watching it multiple times. You go REALLY fast. I think one of the things that is so confusing about these things is the fact that there are multiple ways to do them so it seems like every example is a little different adding to the confusion.
Thank you very much you have explained it very clearly
Great. Thank you so much🙂
Nice and neat explanation 👍
Clean AND Perfect 💝
Great vids dude, keep it going
Thanks man! You really helped me!
Thanks a lot! really helped me
When you want to explain one idea, try to make the surrounding ideas as simple as possible. Here rather than concentrating on callback we start following that many classes that call each others. Thank you for tutorial.
Thanks for the feedback!
Good demonstration, good selection of examples but for someone with Zero Background a little bit too much at once.
Really liked the way that you explained. But it would be really cool if you also had a git link for the code. I was stuck with async programming for a month, posted question in stack yet everyone was going for coroutines asking me to suspend a function until it gets a result back? I quite didn't get that either.
I'm glad it helped you! I just uploaded the source code here: github.com/jacobklewis/Scratch-Notes/blob/master/src/main/kotlin/me/jacoblewis/callbacks/Callbacks.kt
I will likely create a video on coroutines later; in fact, I actually prefer coroutines. However that was outside of the scope for this video.
Message me if you have more questions!
How would compatibility between Kotlin and java work for lamba ? For eg , invoke the callback through a kotlin file but it passes down to a java file which ultimately needs to implement this callback
How is delay accepting another argument?
delay(type.brewTime){
val madeCoffee = Coffee(type)
callback.onCoffeeBrewed(madeCoffee)
}
Why is this not giving error?
I am trying to fetch API data and show in the TextView. Where do I put the reference to callback function? I am using simple HttpURLConnection and InputStream to fetch the data.
The delay function here is a custom function to simulate something like a network request. It might be confusing if you're familiar with coroutines because there is a delay function here as well. You could replace this with an async network request. The async network request will likely have it's own type of closure, however this is dependent on the framework used. Are you building something for Android or only the JVM?
@@kotlinbytes95 i am building for android. can you provide the source code you showed in the video? I dont know where to put the reference to the callback function.
Cheenu soni,
Here is a simple network library that I recently published to GitHub:
github.com/jacobklewis/Simple-Network
Look at the README for details on how to use. It utilizes the built in HttpsURLConnection classes that are provided with Android. Feel free to use this code in any way you'd like. Note that HttpsURLConnection is a "blocking" network library (it will make the UI freeze), so it needs to be wrapped in something that will execute it on an IO thread. This library handles that for you.
Here is the direct library source code:
github.com/jacobklewis/Simple-Network/tree/master/network/src/main/java/me/jacoblewis/network
If you are open to other libraries, here are a few other considerations:
OkHttp: github.com/square/okhttp
Retrofit: square.github.io/retrofit/
Not clealry understand by the first time, i think you should initiate classes in one file for clarity
My brain is getting numb