Ejemplo n.º 1
0
    @Override
    protected String doInBackground(String... params) {
      String url = params[0];
      ArrayList<Building> lcs = new ArrayList<Building>();

      try {

        String webJSON = getJSONfromURL(url);
        Log.d("JSON", webJSON);
        Gson gson = new Gson();

        JsonParser parser = new JsonParser();
        JsonArray Jarray = parser.parse(webJSON).getAsJsonArray();

        for (JsonElement obj : Jarray) {
          Building cse = gson.fromJson(obj, Building.class);
          Log.d("COURSE", cse.toString());
          lcs.add(cse);
        }

      } catch (Exception e) {
        Log.e("nearestBuilding", "JSONPARSE:" + e.toString());
      }

      values.clear();
      values.addAll(lcs);

      return "Done!";
    }
Ejemplo n.º 2
0
 @Override
 public String toString() {
   return "RealEstate{"
       + "name='"
       + name
       + '\''
       + ", building="
       + building.toString()
       + ", address="
       + address.toString()
       + '}';
 }