2
Hello friends I have the following method that requests to the server:
public MetaDataR metodo1(final String m) {
Call<MetaDataR> call2 = new RetrofitConfig().getMetasService().getMetas(m);
call2.enqueue(new Callback<MetaDataR>() {
@Override
public void onResponse(@NonNull Call<MetaDataR> call, @NonNull Response<MetaDataR> response) {
if (response.body() != null) {
MetaDataR iten = response.body(); ////Quero retornar "iten" para o metodo1()
}
}
}
@Override
public void onFailure(@NonNull Call<MetaDataR> call, @NonNull Throwable t) {
// tratar algum erro
Log.e("Erro", "Erro ao buscar:" + t.getMessage());
}
});
return null;
}
This way it returns NULL always. I need it to return the value that comes from the server, that is to wait for the request and return "iten". It is possible?
Okay, thanks @ramaral, I’ll digest that is trying another alternative.
– Emerson Barcellos