/** Gets called when the QR code was read is provided by zxing */
  public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    // Cancel if activity result is not a QR code scan result
    IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
    if (result == null) {
      super.onActivityResult(requestCode, resultCode, intent);
      return;
    }

    // User cancelled QR code scanning?
    if (result.getContents() == null) {
      Toast.makeText(getActivity(), R.string.canceled_toast, Toast.LENGTH_LONG).show();
      return;
    }

    qrData = result.getContents();
    tryHandleQRData();
  }
  @Override
  protected void onViewAndAdtnServiceReady(View view, IService service) {
    super.onViewAndAdtnServiceReady(view, service);

    setHasOptionsMenu(service.getPreferences().getShowHelpButtons());

    // Set up button handler for launching the ZXing QR code scanner
    ImageButton button = (ImageButton) view.findViewById(R.id.qrReadButton);
    button.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            new GroupQRReaderWriter()
                .initiateScan(ScanGroupKeyFragment.this, getString(R.string.scan_groupKey));
          }
        });

    tryHandleQRData();
  }