Retrofit Calls and RxJava

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.พ. 2025
  • In this video I get the dependencies required to use RxJava so we can return Flowable objects from the Retrofit requests.
    Returning a flowable object instead of a Retrofit Call object will make it much easier to handle the http requests.
    ➤ Watch the dagger course free:
    ↻ codingwithmitc...
    ➤ Code for this video:
    ↻ github.com/mit...

ความคิดเห็น • 37

  • @hessamemami6936
    @hessamemami6936 5 ปีที่แล้ว +5

    Hey Mitch,Just wanted to say thank you for all your efforts and your great RxJava and Dagger course.It really helped me understand some things that I couldn't before

  • @kirill4531
    @kirill4531 5 ปีที่แล้ว +3

    So my next course would be RxJava :) Great lesson! Love this series.

  • @iftak01
    @iftak01 3 ปีที่แล้ว

    Thanks my man..without dagger... this is helpful lol

  • @rashedulhasan5372
    @rashedulhasan5372 5 ปีที่แล้ว +1

    cool! cant wait to watch the next video...

  • @pradeepkumarreddykondreddy7048
    @pradeepkumarreddykondreddy7048 4 ปีที่แล้ว +2

    What is the use of @Expose annotation ?

  • @MerthanE
    @MerthanE 5 ปีที่แล้ว +10

    Why the conversion from Flowable to Observable? Can´t you receive a Observable directly?

    • @mohammedhamouda104
      @mohammedhamouda104 5 ปีที่แล้ว +6

      yes he can but won't be able to convert it to LiveData object if its observable because the method that converts from Rx object to LiveData takes only instances that implement the Publisher interface, Flowable object implements the Publisher interface which is not the case in the Observable.

    • @kirill4531
      @kirill4531 5 ปีที่แล้ว

      @@mohammedhamouda104 I think you made a mistake, you wrote that adapter RxJava->LiveData works only with the one who impl. Publisher, then you wrote that Flowable impl. Publisher... doesn't make sense. Just asking. Thx

    • @rinatdiushenov4397
      @rinatdiushenov4397 5 ปีที่แล้ว +1

      @@mohammedhamouda104 exactly what i was wondering, thanks

    • @mohammedhamouda104
      @mohammedhamouda104 5 ปีที่แล้ว

      @@kirill4531 why doesn't make sense, sorry I'm not sure I can understand exactly ur point, please describe it a little bit more. Sorry if this is late just seen it and thanks for ur comment :)

    • @mohammedhamouda104
      @mohammedhamouda104 5 ปีที่แล้ว

      @@rinatdiushenov4397 :) welcome

  • @aboutprogramming7952
    @aboutprogramming7952 3 ปีที่แล้ว

    Thank 🙏 sir

  • @DanielSincAlexandru
    @DanielSincAlexandru 4 ปีที่แล้ว

    Hey Mitch! I am facing some problem at Retrofit Request (retrofit2.adapter.rxjava2.HttpException: HTTP 404 ). Could you tell me where I could find the answer? I followed everything you done. Thank You

  • @StoryOfTheReality
    @StoryOfTheReality 5 ปีที่แล้ว

    I have a question, I do not know there are object or object of array on API response, What can I do at this situation ?

  • @ammarseud5461
    @ammarseud5461 5 ปีที่แล้ว +2

    Hey Mitch, thanks for the great courses, learning a lot from your channel! I have a couple of questions though about this video...
    Why not use Observable in the first place instead of Flowable?
    From documentation of RxJava2CallAdapterFactory: "Adding this class to Retrofit allows you to return an Observable,
    Flowable, Single, Completable or Maybe."
    Also, why are we using an Observable instead of a Single if we are interested in receiving a single value?

  • @igorgreccolacourt5058
    @igorgreccolacourt5058 5 ปีที่แล้ว

    Hey, Mitch! Great course! But I have a question: why didn't you returned a Retrofit's Call object for using que asynchronous Retrofit's .enqueue()? You could then wrap the response in a livedata object to be observed from the activity. Why did you choose to use RxJava in this case?

  • @kirill4531
    @kirill4531 5 ปีที่แล้ว

    I was wondering why did you use Flowable and not Observable and I found this:
    Use Observable when you have relatively few items over time (

    • @codingwithmitch
      @codingwithmitch  5 ปีที่แล้ว +1

      Only Flowable can be converted to LiveData. At least at the time I made this video.

    • @kirill4531
      @kirill4531 5 ปีที่แล้ว

      @@codingwithmitch got it. Thank you

  • @vyommaitreya
    @vyommaitreya 4 ปีที่แล้ว

    Hey Mitch, great videos. Could you help me with finding resources to use authorisation with Firebase instead of Retrofit?

  • @farhadbhai7558
    @farhadbhai7558 3 ปีที่แล้ว

    Can i use the returned object in Main UI?

  • @b.k4142
    @b.k4142 5 ปีที่แล้ว +1

    Hey everyone should i learn Rx java before dagger2? thanks

  • @liot_
    @liot_ 5 ปีที่แล้ว

    Hi Mitch! Infinit thanks for you videos! I always learn a lot. I have question, in this case of using retrofit calls and rxjava together, if i want to replace the response with a hardcoded json (just for testing purpose before using the real api, i used to do it with a json located in my asset folder for example), how can i do that, in wich part of the code you would do that? When i use just retrofit i can do that easily by replacing the response.body()...

    • @codingwithmitch
      @codingwithmitch  5 ปีที่แล้ว +1

      Glad my videos help you.
      I'm not sure. I always just test on the real API.

    • @liot_
      @liot_ 5 ปีที่แล้ว +1

      @@codingwithmitch OK! I will continue trying! I use to have different hardcoded jsons to test all the respose's posibilities and handle them correctly. Thanks from Argentina!

    • @codingwithmitch
      @codingwithmitch  5 ปีที่แล้ว +1

      @@liot_ Good luck.

  • @DanTheTravelDude
    @DanTheTravelDude 5 ปีที่แล้ว +1

    Your tutorials are great! But I would have been more happy if you used Koltin. Or May be your kotlin usage might be in the paid courses :D

    • @codingwithmitch
      @codingwithmitch  5 ปีที่แล้ว +1

      I'm using Kotlin now in both paid and free courses. This was the last java course.

    • @anaslamaiz2079
      @anaslamaiz2079 4 ปีที่แล้ว

      kotlin bad java good

  • @slaviboy
    @slaviboy 2 ปีที่แล้ว

    7:18 whoops 😬

  • @tejaspatel4397
    @tejaspatel4397 5 ปีที่แล้ว

    hey mitch thank you for the great tutorial but i'm having some troubles getting data from retrofit my request ends up with error in logcat which is not displaying the throwable exception. first i thought it was a network-security issue which i solved but the response still goes to error block and i don't know what i'm doing wrong as i'm following your each and every step. i'm pasting my logcat with this comment please check it and help me escalate my issue.
    logcat - github.com/tpatel27/DaggerDemo/blob/development/app/assets/logcat.txt

    • @CodeBlazeX
      @CodeBlazeX 5 ปีที่แล้ว

      uninstalling the app from the emulator and launching again worked for me

  • @tauseefrajput1709
    @tauseefrajput1709 5 ปีที่แล้ว +1

    First viewer