Example #1
0
  // PARSE JSON
  private void parseJSON(JSONObject closest_station) {

    try {

      to_latitude = closest_station.getDouble("latitude");
      to_longitude = closest_station.getDouble("longitude");
      station_name = closest_station.getString("name");
      JSONArray listOfTrains = closest_station.getJSONArray("trains");
      trainsAtStation = "Trains At Station: " + listOfTrains.join(",");
    } catch (JSONException e) {
      e.printStackTrace();
    }
  }
Example #2
0
 @Override
 public String genInsertSQL(String table, JSONArray jaFields) {
   String[] vh = new String[jaFields.length()];
   Arrays.fill(vh, "?");
   try {
     return new StringBuffer("INSER INTO \"")
         .append(table.toUpperCase())
         .append("\" (\"")
         .append(jaFields.join("\", \""))
         .append("\") VALUES (")
         .append(StringUtils.join(vh, ", "))
         .append(")")
         .toString();
   } catch (JSONException e) {
     throw new RuntimeException(e);
   }
 }