@IBAction
 public void toggleRecording() {
   if (!movieFileOutput.isRecording()) {
     recordButton.setImage(UIImage.create("player_stop"), UIControlState.Normal);
     startRecording();
   } else {
     recordButton.setImage(UIImage.create("player_record"), UIControlState.Normal);
     movieFileOutput.stopRecording();
     if (timer.isValid()) {
       timer.invalidate();
     }
   }
 }
  private void configureImageButton() {
    // To create this button in code you can use UIButton.create() with a
    // parameter value of UIButtonType.Custom.

    // Remove the title text.
    imageButton.setTitle("", UIControlState.Normal);

    imageButton.setTintColor(Colors.PURPLE);

    UIImage imageButtonNormalImage = UIImage.getImage("x_icon");
    imageButton.setImage(imageButtonNormalImage, UIControlState.Normal);

    // Add an accessibility label to the image.
    imageButton.setAccessibilityLabel("X Button");

    imageButton.addOnTouchUpInsideListener(this);
  }