@Override
 public void onActivityResult(int requestCode, int resultCode, Intent intent) {
   super.onActivityResult(requestCode, resultCode, intent);
   IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
   if (scanResult != null) {
     ((FormEditText) builder.getDialog().findViewById(R.id.device_code_input))
         .setText(scanResult.getContents());
   }
 }
 @Override
 @SuppressWarnings("deprecation")
 protected Dialog onCreateDialog(int id) {
   switch (id) {
     case ActivateDeviceDialogBuilder.DIALOG_ID:
       builder = new ActivateDeviceDialogBuilder(this);
       return builder.getDialog();
     case ModifyDeviceDialogBuilder.DIALOG_ID:
       return new ModifyDeviceDialogBuilder(this).getDialog();
     case DeleteDeviceDialogBuilder.DIALOG_ID:
       return new DeleteDeviceDialogBuilder(this).getDialog();
   }
   return super.onCreateDialog(id);
 }