umtblbl
Member
Hi friends, I'm developing a simple weather app and trying to pull data with retrofit. I'm debugging the code.
compositedisposable.add (apiservi by .....
Here, in the 36th line when debugging "variables are not avaible" writes and stops, I can not pull data.
-> newConsumer <WeatherResult> ... shows the following suggestion.
"Anonymous new Consumer <WeatherResult> (Ctrl + F1)
Inspection info: Reports all anonymous classes
Lambda syntax is not supported under Java 1.7 or earlier JVMs. "
If you want to review GithubLink:https://github.com/rumtblbl/LocationWeatherApp
Please Help Me, Thank you.
WeatherCityNameServiceImp.java
compositedisposable.add (apiservi by .....
Here, in the 36th line when debugging "variables are not avaible" writes and stops, I can not pull data.
-> newConsumer <WeatherResult> ... shows the following suggestion.
"Anonymous new Consumer <WeatherResult> (Ctrl + F1)
Inspection info: Reports all anonymous classes
Lambda syntax is not supported under Java 1.7 or earlier JVMs. "
If you want to review GithubLink:https://github.com/rumtblbl/LocationWeatherApp
Please Help Me, Thank you.
WeatherCityNameServiceImp.java
Code:
package com.example.locationweatherapp.Data.Network.Service;
import android.view.View;
import android.widget.Toast;
import com.example.locationweatherapp.Data.Network.ApiClient;
import com.example.locationweatherapp.Data.Network.ApiInterface;
import com.example.locationweatherapp.Data.Network.Model.WeatherResult;
import com.example.locationweatherapp.Utility.Utils;
import com.squareup.picasso.Picasso;
import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
public class WeatherCityNameServiceImp implements WeatherCityNameService {
private ApiInterface apiService;
CompositeDisposable compositeDisposable;
@Inject
public WeatherCityNameServiceImp() {
apiService = ApiClient.getClient().create(ApiInterface.class);
compositeDisposable = new CompositeDisposable();
}
@Override
public void weatherCityNameService(String cityName, final ServiceCallBack<WeatherResult> callBack) {
compositeDisposable.add(apiService.weatherCityNameService(cityName, Utils.APP_ID, "metric")
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<WeatherResult>() {
@Override
public void accept(WeatherResult weatherResult) throws Exception {
callBack.onResponse(weatherResult);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
callBack.onError(throwable.getMessage());
}
})
);
}
}