Skip to content
Advertisement

Tag: retrofit2

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

GSON flat down map to other fields

So I have an Android app which uses Retrofit for API. I have a class like which looks like: When GSON creates a JSON it looks like: Would it be possible to change JSON serialization to: Thanks. Answer Here is how Gson could be used to implement the flattening: I’ve put some comments explaining “whats” and “hows”. But it would

Mocking nested retrofit api calls using MockWebServer

I am writing a junit test using okhttp3.mockwebserver for a retrofit2 rest api. The trimmed down api looks like this: The api is then injected to another class which delegates the calls thusly: I do the following in my test: Because the implementation of cancelOrder() calls api.cancelOrder() and then api.getOrders(), I added two mocked responses corresponding to each. However, looks

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 : http://worldtimeapi.org/api/timezone/Europe/Istanbul (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

I want to add a bearer token to my retrofit post request

I have an app that is to register people into a platform but I get a response of Unauthenticated each time I submit the form data. The form is submitted using an API which requires a bearer token for each post request with the aid of retrofit. I have been out of touch with Java. Note: its just a plain

Handle Response Kotlin Retrofit

I’m new to Kotlin and android development. Have been struggling to get my retrofit api to work. But have found a way to do it after some search on SO. I get the data response now, but I don’t know how to “separate” it, so that i can work around with it. this is my json response: and my model

Cannot be provided without an @Provides-annotated method (Dagger 2 in Android Kotlin)

searched on many sites and in various articles, but without effect, so I ask for your help with Dagger 2 (DI) I can not understand what the problem is I’m new to Dagger 2 (Di) and I’m just studying it, please help me understand My code: MainActivity.kt App.kt ServiceBuild.kt NetworkService.kt AppNetworkModule.kt AppComponent.kt Build error Answer Change your code ServiceBuild to

Retrofit2, Android, @Get Parsing for the Array of Array

I am parsing the title correctly and displaying it in a listview. I cant seem to access the seen below. Here are the two objects, sample response and my call. response pojo: first object second object response: I am getting the title just by passing ‘result’ into the adapter and using result[i].getTitle(); I tried using result[i].Details[0].findMe; but my error response

Advertisement