Category : retrofit

I need to pass “type=Café” as the query parameter in Android using Retrofit @GET(“ROOT/api/search”) fun search( @Query(“type”) type: String? = null ): Deferred<Response<List<SearchResult>>> This is how the type=Café is passed in the request URL in Android type%3DCaf%25C3%25A9% But in iOS it is passed as and for this backend returns the search items list type%3DCaf%C3%A9 For ..

Read more

Trying to make a weather app with retrofit and I’m struggling to understand what’s going on here and if anyone could help me? Here is the class for getting weather: public class WeatherOWM { private double latitude; private double longitude; private Context ma; private MainActivity x; private ForecastAdapter weatherData; public static String baseUrl = "http://api.openweathermap.org/"; ..

Read more

I wanted to update this private val api in the function getMenu but i don’t know how. My idea was to change the base api url depending of the user interaction with a spinner. @Singleton class WwMenuRepository @Inject constructor(private val api: ApiInterface, private val gson: Gson, private val applicationPreferences: ApplicationPreferences, @Named("is_stage") private val isStage: Boolean, ..

Read more

im using retrofit, and i have two model with one adapter. i get my data from server and they are ok, but when i give the response to the model (on setAmazingOffer methode) i am received this error: 2021-01-19 20:56:33.984 12860-12860/com.nadi.shopping E/AndroidRuntime: FATAL EXCEPTION: main Process: com.nadi.shopping, PID: 12860 java.lang.ClassCastException: java.util.ArrayList cannot be cast to ..

Read more

I want to set the BaseUrl in Retrofit to change dynamically between stage and live because i have an app that has stage and live version. So i made a spinner and the user can select either he wants. But the problem is that after the user select the flavor he wants and then wants ..

Read more

I am trying to send Json with formated Date (pattern="yyyy-MM-dd HH:mm:ss").The problem is that server don’t recognize this pattern and give error java.io.EOFException: n not found: limit=1 content=0d… I tried add GsonBuilder in RetrofitClient class, but it doesn’t worked. String mobileDate= (String) android.text.format.DateFormat.format("yyyy-MM-dd HH:mm:ss", new java.util.Date()); RetrofitClient public class RetrofitClient { private static Retrofit retrofit=null; ..

Read more