Questions tagged [retrofit]
Retrofit is a type-safe REST client for Android and Java by Square, Inc.
8,110
questions
-1
votes
0
answers
8
views
Nullpointexception on a object from Data Base with inner join
I´m trying to get an info from an object contains in another object but a Nullpointexception is showed
D/OkHttp: --> POST http://192.168.1.7:8080/getProfesores/grupo?grupo=Verde
D/OkHttp: Content-...
0
votes
0
answers
9
views
how to pass query paramter in retrofit android having special symbols?
This is the get request which I have to call through retrofit android java. How can I make the request for given url sample?
/api/resource/:doctype?filters=[["field1", "=", "...
0
votes
2
answers
58
views
Kotlin reflection
With Retrofit, I am fetching data and getting JSONObject with the structure like this for example:
{
"token": "some-token",
"tiles": [
{
"...
0
votes
1
answer
21
views
How to send a request with file upload in flutter retrofit
I'm using flutter retrofit package
and I need to implement a request as shown in attached postman screenshot
this is what I do, but it didn't work
@override
@POST('/update/document')
@MultiPart(...
0
votes
0
answers
17
views
How to pass runtime parameter like base URL in retrofit with hilt And How to pass base URL from repository?
-This is the Network Module class where I want to add a parameter of URL dynamically at runtime for my retrofit builder. And that URL I want to pass from repository.
@InstallIn(SingletonComponent::...
0
votes
0
answers
23
views
Simplifying multiple retrofit instances in Hilt Module
I'm developing an Android application in which my user needs to target 2 different endpoints based on some configuration on their profile. I've refactored the entire application trying to use Clean ...
0
votes
1
answer
22
views
Why retrofit returns null in response body?
Get null response results in response body. Using retrofit, dagger and repository. Why get null in response I don't know. My model seem right. Whats the problem?
MainViewModel.kt
@HiltViewModel
class ...
0
votes
1
answer
47
views
How to send raw json in request body
In Flutter using retrofit package
I need to send json raw object as shown in the postman snapshot.
I tried to do it by this method but didn't work
@override
@POST('/profile')
Future<UserModel> ...
0
votes
1
answer
34
views
Synchronous API call using retrofit execute [duplicate]
Im trying to do a synchronous api call in Kotlin android, actually I'm having a function with 2 parameters and I need to make a post request and get a particular response for it and depending on the ...
0
votes
1
answer
31
views
Room database query for several Entities
Could you please help me? I try to get data from TMDB via Retrofit2 to Room database and display it in Recyclerview. I make 3 api calls to get data about popular movie id/poster/overview/title/genres, ...
0
votes
0
answers
19
views
Request headers is not going along with request in retrofit 2.6.0 android kotlin
I am trying to call an API through our app with an authorization token. I have tried all available solutions with no luck.
Here is my retrofit client with okhttp
companion object {
var token: ...
0
votes
0
answers
22
views
Generated .g file has errors
Everytime i run the flutter packages pub run build_runner build --delete-conflicting-outputs command I end up with a .g file with errors.
This is the service class I implemented myself
part '...
0
votes
1
answer
23
views
Retrofit Call.enqueue method not being called - kotlin
i was able to make Edit and Delete work in a test project, using Retrofit2, but now i needed to used it in my real project, and despite the code and webservice used (created using Slim 4 and Notorm) ...
1
vote
0
answers
16
views
What is the correct way to handle UnAuthenticated response (401) in Android retrofit
I want to take the user to the login screen whenever I encounter a 401 response from the server.
I am currently handling 401 like this:
public abstract class BaseCallback<T> implements Callback&...
-1
votes
0
answers
23
views
livedata success is received thrice and retrofit call twice when making a retrofit call
I have a retrofit call which get list of cars.
but when I check the logs, retrofit call is made twice and the SUCCESS in my fragment viewModel.selectedCar().observe(viewLifecycleOwner) { r is executed ...
0
votes
2
answers
20
views
Chain Completable and a Single RxJava + Retrofit
In My repository, I have two API calls that should be done sequentially.
First API call returns Completable -> If this API call fails, we should not proceed further, if it succeeds we should ...
0
votes
0
answers
15
views
mock retrofit service observable not calling onError method Android Mockito
I am testing this code and I got success in the success response code but I am not able to reach the onError code
internal class MaintenanceStatusResponseHandler {
fun getMaintenanceResponse (...
1
vote
0
answers
29
views
Post and receive Json String using retrofit in an android application
I am new to android coding.
In my android application , I have to match a string present in a log file on the server with the current signature of the android application using retrofit client. But I ...
0
votes
0
answers
13
views
Version compatible?
Whether retrofit 2.9.0 can compatible okhttp3 version higher than 3.14.9 or not?
retrofit 2.9.0 -> okhttp3:3.14.9
sentry 5.7.3 -> okhttp3:4.9.2
last input okhttp3:4.9.2 + sentry 5.7.3 + retrofit ...
0
votes
0
answers
44
views
Empty json response
I'm fetching data from API. I get the json response normally when I use the browser. But it's empty when I use retrofit.
This this the api interface:
interface FootballApi {
@GET(".")
...
0
votes
1
answer
54
views
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 2 path $ while UPDATE
Hello i am creating an android App for Students to easily find rooms to stay, as a School Project, and i am having some trouble with Update. I created an webservice with 000webhost.com. I already ...
0
votes
1
answer
36
views
Generics with moshi and retrofit
Im fairly new to Java/Kotlin, so understanding the "technical" Docs is kinda had for me.
I have an API which gives me something like this
/city/someCityName
{
"path": "...
0
votes
0
answers
15
views
How to refresh every 5 minutes and cache clear in 24 hours in retrofit method in kotlin
In java, they have used parseNetworkResponse. In kotlin what should i use for refreshing every 5 minutes and clear cache in 24 hours. I have used Retrofit method in the project.
0
votes
0
answers
35
views
Why doesn't Retrofit get a faster response after the first request?
I am doing some research on Retrofit and AsyncTask.
I write a simple code that use AsyncTask + HttpUrlConnection to send a GET reuest to jsonplaceholder to retrive some json sample. And the respond ...
0
votes
2
answers
29
views
Android Studio showing this error :Retrofit2 Android HTTP method annotation is required (e.g., @GET, @POST, etc.)
It keeps showing me this error in Android Studio, I am using retrofit 2, trying to get data from Yelp API and it keeps showing me this msg
java.lang.RuntimeException: Unable to start activity ...
0
votes
0
answers
13
views
when scroll end multiple request retrofit send when user two time bottom hit how to control it
I am using retrofit in my app to get data from server 15 results each request all working is fine but when I hit bottom retrofit send a request for new data it's fine but sometimes when progress is ...
-1
votes
1
answer
38
views
How to parse raw data in android kotlin using retrofit?
I have a webservice api which is having some raw data. No json structure data. And all i want to parse it. This is the response i am getting from an api.
And here is my implementation for calling the ...
0
votes
0
answers
21
views
Unresolved reference: providesHttpAdapter
When I tried to input providesHttpAdapter in HomePresenter for variable datasource from NetworkModule, there was no reference regarding that reference from file NetworkModule just because I changed ...
0
votes
0
answers
23
views
How to read List of Any type from class Model class in Kotlin?
I have a response structure like that
[
{},
{},
{},
[],
[],
{},
{}
]
When I create model class it give me List of type Any.
I cannot be able to read mix arrays and object in a List?
Can I do it using ...
1
vote
0
answers
9
views
How to load more items without pages in API in Android recyclerview?
I am trying to add a load more feature in my recyclerview. I followed some tips I found on Stackoverflow but each one requires the existence of pages in the API. In my API there are no pages and that'...
-1
votes
0
answers
22
views
How to extract data from jsonArray using retrofit and Gson and add extracted data in RecycleView?
Hi am trying to retrieve hourly weather data from openweatherAPI's and add them in recycleView. I have no idea what to do,i tried many ways from tutorials but i ended up getting this error.
Expected ...
1
vote
1
answer
35
views
API data not getting converted to java object
I'm using a openweathermap API , which is One Call API, to get the current and future 7 days weather details. I'm able to retrieve all the static data which is not nested , but for the data which is ...
3
votes
3
answers
179
views
Android RecyclerView only contain one item after adding items got from asynchronous retrofit calls
I have a recycler view for image display with a simple adapter.
public class ImageListAdapter extends RecyclerView.Adapter<ImageListAdapter.SingleItemRowHolder> {
private ArrayList<...
0
votes
1
answer
21
views
Get genre name corresponding to genre_id in TMDB API
Could you please help me? I try to get the movie title, image, and genre from TMDB API and show it in recycler view. I managed to get the image and title but I have problems with the genre. Instead of ...
0
votes
2
answers
30
views
Parse an Array into a Recycler view from Json with Retrofit
Hello i am practicing my kotlin skills with retrofit and recycler views, and i found this type of data in some JSON i found for my practice
"capital":[
"Montevideo"
]
I ...
0
votes
1
answer
28
views
Unable to invoke no-args constructor for class ConversionRates
I have a Currency Converter Android app. I 'm using retrofit for getting rates from API but as far as I'm concerned my app can't get data from api and it returns that exception
Unable to invoke no-...
0
votes
2
answers
55
views
how to Access to the Response body in the retrofit?
I changed the Volley library to Retrofit. Now I want to access the response body like the Volley library. I searched the internet and came up with this solution, but when I run the program, the ...
0
votes
0
answers
15
views
how to delete android recyclerview data through php api using retrofit into adaptor?
I try to use the following code but doesn't work at all.
When I hit delete button, nothing is happening and query is also not getting deleted.
holder.delete.setOnClickListener(new View.OnClickListener(...
0
votes
0
answers
15
views
Im creating app to print user`s repos as a recyclerview. Im using retrofit to get data from github API. Basically, app compiles, bot nothing shows up
RecyclerView
class RecyclerViewAdapter: RecyclerView.Adapter<RecyclerViewAdapter.RepoViewHolder>(){
inner class RepoViewHolder(val binding: RepoelementBinding): RecyclerView.ViewHolder(binding....
0
votes
0
answers
14
views
Retrofit2: 504 Unsatisfiable Request (only-if-cached)
I am trying to cache a network response using Retrofit2's caching. However, when I try to use the cached response, I get the error in the title. Here is what I have:
public OkHttpClient provideClient(@...
0
votes
1
answer
25
views
Binary XML file has no LayoutManager
This is the error I'm getting:
Process: com.tunedapps.finalproject, PID: 18290
android.view.InflateException: Binary XML file line #7 in com.tunedapps.finalproject:layout/news_deatils_fragment: ...
1
vote
0
answers
21
views
Rxjava polling with observable
I would need to do an API call every 1 second and keep retrying while the "status" is "in_progress". However, every time I do the API call, I would receive a new QR code which I'd ...
0
votes
1
answer
45
views
Error uploading Multipart to MongoDB using Ktor
I'm trying to upload a JPEG to MongoDB using Ktor and Kotlin but keep getting an error:
java.io.FileNotFoundException: /document/image:32: open failed: ENOENT (No such file or directory)
Please help ...
0
votes
0
answers
15
views
Kotlin Retrofit response.data() returned null with kotlin
I'm trying to fetch an API in recyclerview in my breakingNewsFragment but it still a white screen
i use navigation between fragments from:
class NewsActivity : AppCompatActivity() {
lateinit var ...
2
votes
2
answers
107
views
Do I need to mention the coroutine dispatcher while working with Retrofit and Room?
Recently I saw this - Most data sources already provide main-safe APIs like the suspend method calls provided by Room or Retrofit. Your repository can take advantage of these APIs when they are ...
-1
votes
0
answers
31
views
How make a API unit test with MVVM architecture in Android
I have a project that uses Retrofit with MVVM architecture, but unfortunately I don't have much experience with unit testing, so I can't do a test on MVVM, I'm using Koin for dependency injection, I ...
0
votes
0
answers
29
views
java.lang.IllegalArgumentException: No Retrofit annotation found. (parameter #2
this is my API:
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.Response
import retrofit2.http.*
interface BowBuddyAPI {
@POST("/api/v1/create&...
0
votes
1
answer
36
views
After sending data from MainActivity to Fragment, the variables are setup to 0.0
I'm trying to pass from MainActivity to Fragments (by using ViewPager, and TabLayout, if it will help you anyhow) user's latitude, and longitude. The thing is, I receiving 0.0 in the fragment.
...
0
votes
0
answers
46
views
Entity classes have some issues while using retrofit
I am getting this error while getting a response from an API.
Sometimes, it works fine but 8/10 times it crashes and shows me this error
java.lang.NullPointerException: Attempt to invoke virtual ...
0
votes
1
answer
45
views
How to use Zip operator of kotlin flow in Android
In my application I want combine two deferent API with ZIP operator of Kotlin flow.!
Api 1 is Movies list and Api 2 is genres list!
I want loaded each 2 Apis in one time, for this I used zip operator!...