Easy Retrofit 2 Tutorial in Android Studio using Kotlin & Coroutines
Вставка
- Опубліковано 22 лип 2020
- Hey guys! So in this video I'll show you how to create this very basic app using Retrofit2, and hopefully that gives you a basic idea on how to use it. Otherwise in the near future I'll show you how to get a list of objects so you can create a nice app with a recycler view that takes data from the internet!
All you need for this app can be found down below:
Cat Facts API: alexwohlbruck.github.io/cat-f...
Dependencies: github.com/federicocotogno/Ra...
Full project: github.com/federicocotogno/Ra...
Very good explained. There are a lot of 2-3 hours tutorials which contains a lot of irrelevant information combined with an incomplete example. Continue with that sir! I am a subscriber now, and have bookmarked some of your videos because those helps me in my everyday work
Thank you SIR for a very clear tutorial. It works and killed the headaches I had trying to figuring out how Retrofit works in other tutorials. Rainbow and cookies rain on you ^^
beautifully explained. Subcribed!
Awesome video, thanks!
Just what i needed thx!!
i saw so many videos, finally this one helped me fetched data. im just having confusion havin gparameters in API post? do you have custom api calls?
brief and very good
Very good tutorial!
Hello,can u tell me what code is to implement a button instead of layout pls?I hope u will help me.Thanks
Thanks man!
Thank you, I have learnt a lot from your videos!
I just noticed something that you wrapped the interface method returns with Call. But since you are using a version of Retrofit greater than 2.6.0, you can use the data class as the return type. For this to work, you would have to add the 'suspend' keyword before the fun methods in the api interface.
This will enable you to use coroutines automatically without worrying about the context changes as Retrofit is already configured to use a background worker thread for network calls.
Also that plugin is such a godsend, I was using jsonschema2pojo before, but this is much cleaner! :D
I appreciate the feedback! I'll play around with it a little more, I'm still just overwhelmed by how easy Retrofit turned out to be haha
Wow!! That got rid of about 4 lines of code for me. Maybe you should think about starting a coding channel sir. Thanks again for the tip!
Thank you for the kind words, I'm just a student. Learnt it all from you guys!
Could u guys make a simple sample of this? Bcse im strugling to achieve this...weeks on and nothing...=/
Nice video It was helpful, Please can you create a video like this adding room database to it?
Thanks, useful
Thanks palace but, how did u call textViews from layout without using binding?
What i need to do if i have boolean value in json, when i want assign json value to text view value
I just watched 1 video and now i love you man... you are the best programmer i've ever seen; please tell me how i can be like you?
I really hope I'm not the best you've ever seen ahahahaha. I just Google very well, no background in technology or anything. Just keep exploring and let your ambitions take you were you need to go.
@@Indently Thanks, hope you could help me in future
hi
i can't connect to url of api
can you help me? please
спасибо
Ottimo !!!!
Thanks
Can you make a similar retrofit app with Recycler view to display list of data and use Lazy Loading which displays data in parts?
idem!!
But why actually occurs this crash?
I am trying to use this on reddit API n its not working ,,any suggestion
Read the logs and check on Google what the errors are
how about POST request using formurlencoded?
and also delete/post with path
Could you help me?
app crashed (
Thank you for the video, thats really nice. Let me give you advice to dont speak so fast next time:)
no coroutine? suspend fun?
yes
@@Indently hey bro didn't expected to get reply :)
I'm currently learning retrofit 2 with kotlin coroutines and should I use suspend fun or what you have shown here.
@@KotlinBek Definitely try with coroutines if you can, this video is old and a lot has happened since. So definitely don't stop searching for better ways to improve your code!
@@Indently sure thanks. gl 2u2
I mean , i want to press button and get random fact
hello nice job man !!, can you create retrofit kotlin and php using of course *phpstorm* please ! without using java
Instead of using php, create a dummy API using designer.mocky.io/