My project shows the following warning -
An unverified call to 'getWeatherData (T, Boolean, String)' as a raw element of type 'IWeatherCallbackListener'.
I created the following interface -
public interface IWeatherCallbackListener<T> {
void getWeatherData(T weatherModel, Boolean success, String errorMsg);
}
And he called it as follows:
public class WeatherConditions {
private static IWeatherApi mWeatherApi;
public static void getOpenWeatherData(String city, String appId, IWeatherCallbackListener listener) {
mWeatherApi = ApiService.getRetrofitInstance(BASE_URL_OPEN_WEATHER).create(IWeatherApi.class);
Call<OpenWeatherModel> resForgotPasswordCall = mWeatherApi.getOpenWeatherData(appId, city);
resForgotPasswordCall.enqueue(new Callback<OpenWeatherModel>() {
@Override
public void onResponse(Call<OpenWeatherModel> call, Response<OpenWeatherModel> response) {
if (response.body() != null) {
if (listener != null)
listener.getWeatherData(response.body(), true, "");
}
}
@Override
public void onFailure(Call<OpenWeatherModel> call, Throwable t) {
if (listener != null)
listener.getWeatherData(null, false, t.getMessage());
}
});
}
I implemented this interface in my MainActivity and named the as method -
WeatherConditions.getOpenWeatherData(etCityName.getText().toString(), OPEN_WEATHER_APP_ID, MainActivity.this)
Someone can help and explain this warning.
source
share