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...
    ​​​​

КОМЕНТАРІ • 44

  • @karateswe
    @karateswe 3 роки тому +6

    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

  • @Sophie-jp5nd
    @Sophie-jp5nd 3 роки тому +1

    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 ^^

  • @QuanNguyen-og6pq
    @QuanNguyen-og6pq 3 роки тому +1

    beautifully explained. Subcribed!

  • @klekaelly
    @klekaelly 2 роки тому +1

    Awesome video, thanks!

  • @eunjeongchoi5074
    @eunjeongchoi5074 3 роки тому +1

    Just what i needed thx!!

  • @nnasim5089
    @nnasim5089 2 роки тому

    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?

  • @h2d1y2
    @h2d1y2 3 роки тому +1

    brief and very good

  • @collinsk8754
    @collinsk8754 2 роки тому

    Very good tutorial!

  • @Randomuserb249
    @Randomuserb249 3 роки тому

    Hello,can u tell me what code is to implement a button instead of layout pls?I hope u will help me.Thanks

  • @AdrianoSousaJesus
    @AdrianoSousaJesus 2 роки тому

    Thanks man!

  • @dipanzan
    @dipanzan 4 роки тому +6

    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

    • @Indently
      @Indently  4 роки тому +1

      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

    • @Indently
      @Indently  4 роки тому +2

      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!

    • @dipanzan
      @dipanzan 4 роки тому +2

      Thank you for the kind words, I'm just a student. Learnt it all from you guys!

    • @felipepereira3061
      @felipepereira3061 3 роки тому +1

      Could u guys make a simple sample of this? Bcse im strugling to achieve this...weeks on and nothing...=/

  • @kehindeonyekuwuluje2475
    @kehindeonyekuwuluje2475 3 роки тому

    Nice video It was helpful, Please can you create a video like this adding room database to it?

  • @wormeater1954
    @wormeater1954 Рік тому +1

    Thanks, useful

  • @_Privet_Zdarova
    @_Privet_Zdarova 2 роки тому +1

    Thanks palace but, how did u call textViews from layout without using binding?

  • @Andrey-ri5uo
    @Andrey-ri5uo Рік тому

    What i need to do if i have boolean value in json, when i want assign json value to text view value

  • @Rotatesim
    @Rotatesim 3 роки тому +1

    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?

    • @Indently
      @Indently  3 роки тому +1

      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.

    • @Rotatesim
      @Rotatesim 3 роки тому

      @@Indently Thanks, hope you could help me in future

  • @tuanphongang7467
    @tuanphongang7467 2 роки тому

    hi
    i can't connect to url of api
    can you help me? please

  • @elpirato5428
    @elpirato5428 3 роки тому +6

    спасибо

  • @pablohenao157
    @pablohenao157 3 роки тому

    Ottimo !!!!

  • @AlrginCypress
    @AlrginCypress Рік тому

    Thanks

  • @arpitgupta3151
    @arpitgupta3151 4 роки тому +2

    Can you make a similar retrofit app with Recycler view to display list of data and use Lazy Loading which displays data in parts?

  • @haykmkrtchyan7093
    @haykmkrtchyan7093 3 роки тому +1

    But why actually occurs this crash?

  • @atharvadawande1248
    @atharvadawande1248 3 роки тому

    I am trying to use this on reddit API n its not working ,,any suggestion

    • @Indently
      @Indently  3 роки тому

      Read the logs and check on Google what the errors are

  • @kannapipa2270
    @kannapipa2270 3 роки тому

    how about POST request using formurlencoded?

  • @Randomuserb249
    @Randomuserb249 3 роки тому

    Could you help me?

  • @fifagameru
    @fifagameru 3 роки тому +1

    app crashed (

  • @user-gh1gl4go8u
    @user-gh1gl4go8u 4 роки тому

    Thank you for the video, thats really nice. Let me give you advice to dont speak so fast next time:)

  • @KotlinBek
    @KotlinBek 2 роки тому

    no coroutine? suspend fun?

    • @Indently
      @Indently  2 роки тому

      yes

    • @KotlinBek
      @KotlinBek 2 роки тому

      @@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.

    • @Indently
      @Indently  2 роки тому +1

      @@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!

    • @KotlinBek
      @KotlinBek 2 роки тому

      @@Indently sure thanks. gl 2u2

  • @Randomuserb249
    @Randomuserb249 3 роки тому

    I mean , i want to press button and get random fact

  • @youssefmansour5756
    @youssefmansour5756 3 роки тому

    hello nice job man !!, can you create retrofit kotlin and php using of course *phpstorm* please ! without using java

    • @stephanbranczyk8306
      @stephanbranczyk8306 3 роки тому

      Instead of using php, create a dummy API using designer.mocky.io/