@Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    super.onCreateDialog(savedInstanceState);
    // Use the Builder class for convenient dialog construction
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    builder
        .setMessage(getTag())
        .setNegativeButton(
            "否",
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                Message msg = AndroidInterface.getInstance().gameHandle.obtainMessage();
                Bundle bundle = new Bundle();
                bundle.putBoolean("reaction", false);
                msg.what = 6;
                msg.setData(bundle);
                AndroidInterface.getInstance().gameHandle.sendMessage(msg);
              }
            })
        .setPositiveButton(
            "是",
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                Message msg = AndroidInterface.getInstance().gameHandle.obtainMessage();
                Bundle bundle = new Bundle();
                bundle.putBoolean("reaction", true);
                msg.what = 6;
                msg.setData(bundle);
                AndroidInterface.getInstance().gameHandle.sendMessage(msg);
              }
            })
        .setTitle("提示");
    // Create the AlertDialog object and return it
    return builder.create();
  }
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    super.onCreateDialog(savedInstanceState);
    // Use the Builder class for convenient dialog construction
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    try {
      final JSONObject ticketsObj = new JSONObject(getArguments().getString("tickets"));
      final JSONArray tickets = ticketsObj.getJSONArray("data");

      // TODO: stations on wrong order from server

      JSONObject arrivalTicket = tickets.getJSONObject(0);
      JSONObject departureTicket = tickets.getJSONObject(tickets.length() - 1);

      JSONObject departureStationObj = departureTicket.getJSONObject("firstStation");
      JSONObject arrivalStationObj = arrivalTicket.getJSONObject("lastStation");

      String departureStation = departureStationObj.getString("station");
      String departureTime = departureStationObj.getString("time");

      String arrivalStation = arrivalStationObj.getString("station");
      String arrivalTime = arrivalStationObj.getString("time");

      double departureTicketCost = departureTicket.getDouble("totalCost");
      double arrivalTicketCost = arrivalTicket.getDouble("totalCost");

      double finalTicketCost = departureTicketCost + arrivalTicketCost;

      builder
          .setMessage(
              departureTime
                  + " "
                  + departureStation
                  + "->"
                  + arrivalTime
                  + " "
                  + arrivalStation
                  + "("
                  + String.format("%.2f", finalTicketCost)
                  + "€)")
          .setNegativeButton(
              android.R.string.cancel,
              new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                  dialog.dismiss();
                }
              })
          .setPositiveButton(
              android.R.string.ok,
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                  mListener.onDialogTicketConfirmed(ticketsObj);
                }
              });

      // Create the AlertDialog object and return it
      return builder.create();
    } catch (JSONException e) {
      e.printStackTrace();
    }

    return null;
  }