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
Tag: retrofit2
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
how to display categories in data class with retrofit2 – Kotlin
i am trying to display data from API using retrofit2 in koltin but the API shows that there is categoryId before the data i am calling as showing below: i tried to call only (eventName, eventPhoto, eventLink) in my data class as showing below: API interface: Adapter: after i run the application, it shows that the data are null do
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
Data is showing in room database even after deleted from server
I am fetching data from server and saving in room database and then from room showing it in recycler view.Data is perfectly saving in room database and showing in recycler view. Problem: When I am deleting some data from server database then its old copy that saved earlier still persists in room. What I want: I don’t want to show
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