I am trying to fetch JSON from a REST API as a string.
I am using retrofit
with scalarConverter
for that purpose. I am able to pass the URL to fetch and my retrofit instance is also created successfully but I am not getting any response from the server.
PS: there is no request on the server, so that means my request is not going out from my machine.
I am new to android, kindly help me.
Retrofit instance creation:
Retrofit retrofit=new Retrofit.Builder()
.baseUrl(base)
.addConverterFactory(ScalarsConverterFactory.create())
.build();
jsonApi jsonapi=retrofit.create(jsonApi.class);
Call<String> stringcall=jsonapi.getStringResponse(speech);
jsonApi interface:
public interface jsonApi {
@GET
Call<String> getStringResponse(@Url String url);
}
base: it is the base URL
speech: it is a variable containing rest of the URL to be processed.
when I run, the app gets stuck here with this message being displayed in Run Tab:
W/OpenGLRenderer: Fail to change FontRenderer cache size, it already initialized
W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView