0
I’m having trouble converting an array I get via webservice
CustomRequest request = new CustomRequest(Request.Method.GET,
"http://" + url + "/service/usuario/mural",
null,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
ocultaProgressBar();
Gson gson = new Gson();
mural = new ArrayList<>();
for (int i = 0, tamI = response.length(); i < tamI; i++) {
try {
Configuracao configuracao = new Configuracao();
configuracao = gson.fromJson(response.getString(i), Configuracao.class);
mural.add(configuracao);
} catch (JSONException e) {
e.printStackTrace();
}
}
iniciarFragmentoHome();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("Erro",error.toString());
ocultaProgressBar();
}
});
in java I do the same above, already in Swift 3 that is the problem... I am doing so:
Alamofire.request(urlbusca, method: .get)
.responseJSON { response in
if(response.result.isSuccess){
let jsonc = JSON(response.result.value!)
print(jsonc)
let resData = jsonc[0].arrayObject as! String
print(resData)
let conf = Configuracao(json:resData)
self.mensagens.append(conf)
print(self.mensagens)
if self.mensagens.count>0{
print("ok")
self.tbInicio.reloadData()
}
else {
let alert = UIAlertController(title: "Alerta", message: "Sem conexão com a internet!", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "ok", style: .default) { action in
// perhaps use action.title here
})
self.present(alert, animated: true)
}
}
}
I don’t know how to use the get to retrieve the object
What specifically is going wrong, Bruno? "Sponse" comes empty?
– Rici
Oba! actually could not get the values... but I’ve decided to post the solution..
– Bruno Nicoletti
Felipe I have another problem, could you help me? https://answall.com/questions/192148/erro-evreflection-boll
– Bruno Nicoletti