Skip to content

Tag: retrofit

Can I delay the onSuccess method in RxJava?

I have SplashScreenFragment and inside this fragment, I’ll load the data from the server using Retrofit with RxJava, Getting data from the server will take between 1 second to 25 seconds. The SplashScreenFragment must show to the user for at least 8 seconds. When I get the data from the server, The onSuccess method will be called and inside this

Resend Retrofit API call with a OneTimeWorkRequest

I am stuck and can’t get my OneTimeWorkRequest to work properly. I have got this Retrofit API call I want to resend to the backend incase there’s no network connectivity or similar on the phone. What I can’t wrap my head around is how to pass the call to the worker. I’ve got this following code: Here’s the API Service:

How to parse array inside json object in android java?

how to display array data in json object if the json data is like below. I want to display array data of Ingredient and step. This is the full API Address that I want to fetch the data I’ve tried several ways but I can’t find how to implement it properly. this is my json model. This is the

IllegalArgumentException: Unable to create @Body converter for class

Whenever I try to create a request with Retrofit it fails. The strange thing is that it worked before, I didn’t change anything about the code. Now months later it doesn’t work anymore. I’m getting the following error: IllegalArgumentException: Unable to create @Body converter for class apis.Config (parameter #2) I tried changing from Gson to Moshi but it didn’t solve

Android Studio Retrofit Call Failure

I’m trying to use Retrofit in my app via Java. I’m using this worldtime API. You can call this URL in your browser to see the response : (response comes too late, just refresh your browser) I added this line to my AndroidManifest.xml I added these to gradle I only want to see few keys of response, so I

Why does Retrofit onResponse() is called at last and how can i fix it?

Hello I’m trying to get Weather information by using OpenWeatherAPI. So to connect with OpenWeatherAPI I used Retrofit library. (And also my project is using MVVM Pattern) The problem is that the onResponse() of OpenWeatherRepos is called after the init() of the MainActivityClass is terminated. So OpenWeather is still getting null instances. I don’t know much about API call order

Update default Content-Type for multipart form-data request in Android

We are currently using okhttp3 and retrofit2 in Android to make an network api call of type POST with multipart/form-data, the api request and response are as shown below If you observe, the request header Content-Type has “multipart/form-data; boundary=xxxxxx-xxxx-xxx….” Following is the code I’m facing an issue with sending the customised request header Content-Type as “multipart/form-data; **charset=utf-8;** boundary=xxxxx-xxxxx-x…..” basically i

Retrofit Get Data Object

I have a data like this, and i want get report and criteria data. { “response_code”: 200, “message”: “Your report data has been loaded.”, “data”: { …