Issues With Get Request Using Retrofit In Android Studio
I'm using Retrofit 2 in Android Studio to get stop information in JSON form from the CUMTD api for stops by search and for some reason the connection keeps on failing, are the quer
Solution 1:
You didn't provide much (any) information about the failure itself, but it's pretty easy to spot at least one possible bug. In the response you expect a list of Example
objects:
Call<List<Example>> call = mtdApi.loadStops(key,s);
This is not good since you can cleary see in the documentation of GetStopsBySearch that the returned JSON object is not a list (i.e. not a JSON array). Fixing this is really easy, just expect a single Example
object instead of a list of those:
Call<Example> call = mtdApi.loadStops(key,s);
This obviously means that you have to change the signature of the Callback
but you don't need extra info for that.
Post a Comment for "Issues With Get Request Using Retrofit In Android Studio"