我有這樣的代碼:Web服務,JSON和Android。結果WS不正常工作
Carrera userRecived = null;
HttpClient httpclient;
HttpGet httpget;
HttpResponse response;
HttpEntity entity;
/*Call Json service and Unserialize with Gson into the class*/
try{
httpclient = new DefaultHttpClient();
httpget = new HttpGet(Url);
response = httpclient.execute(httpget);
entity = response.getEntity();
String result= EntityUtils.toString(entity);
Gson gson = new Gson();
userRecived = gson.fromJson(result, Carrera.class);
}catch(Exception error){throw new Error("Error en el get -- "+error.toString());}
我的問題是下一個錯誤: 03-08 19:07:42.899:E/AndroidRuntime(959):java.lang中。錯誤:錯誤EN EL getcom.google.gson.JsonParseException:期待陣列,但找到的對象:[email protected]
我從PHP Web服務等待結果,結果可能在下一個JSON:
[{"Codigo":"1","Denominacion":"Popular de Xativa","Imagen":"1231313","Poblacion":"Xativa","Lugar":"Valencia","Fecha":"11 de Noviembre de 2012","Hora":"17:00","Descripcion":"para probar","Reglamento":"http:\/\/www.google.es","Kilometros":"21"}]
我有一個卡雷拉在哪裏存儲這些信息。
我希望有人幫助我。 謝謝。
請把日誌結果,並顯示是正確的或不... – 2012-03-08 19:51:05