Código:
@Override protected Boolean doInBackground(Void... arg0) { try { WebService _ws = new WebService(); String response = _ws.webGet(ServiceConfiguration.UsersOnline); String responseCM = _ws.webGet(ServiceConfiguration.CountMessages); HashMap<String, Object> params = new HashMap<String, Object>(); params.put("index", "0"); params.put("size", "2"); String responseAM = _ws.webGetWithToken(ServiceConfiguration.AllMessages, params); if (response != null && !response.equals("")) { Type collectionType = new TypeToken<Usuario[]>() {}.getType(); Usuario[] usuarios = miGson.fromJson(response, collectionType); if (responseCM != null && !responseCM.equals("")) { respCM = Integer.parseInt(responseCM); if (responseAM != null && !responseAM.equals("")) { Type collectionTypeAM = new TypeToken<Message[]>() {}.getType(); Message[] messages = miGson.fromJson(response, collectionTypeAM); publishProgress(messages); //return true; } else { return false; } } else { return false; } } else { return false; } } catch (Exception e) { Log.i("valores", "Error al leer el json"); e.printStackTrace(); } return null; }