I am loading some data from the server using the Retrofit Library. While loading some data from the server It is creating trouble. Some time the data is loaded. Some time is not loading and showing the following Exception in the Log. I am not understanding what to do now.
Exception:
java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 2418 path $.data[2].run
I am getting error in this java class on Line " return Observable.fromCallable(new Callable()" and on line "return call.execute();".
public class APIExecutor
{
public static Observable<Response> call(final Call call)
{
BackgroundThread bgThread = new BackgroundThread();
bgThread.start();
Handler bgHandler = new Handler(bgThread.getLooper());
Observable<Response> observable = Observable.defer(new Func0<Observable<Response>>()
{
@Override
public Observable<Response> call()
{
return Observable.fromCallable(new Callable<Response>() {
@Override
public Response call() throws Exception
{
return call.execute();
}
});
}
});
return observable
.subscribeOn(HandlerScheduler.from(bgHandler))
.observeOn(AndroidSchedulers.mainThread());
}
}