/** ErrorOccurred event handler. */
 @SimpleEvent(
     description =
         "Event raised when an error occurs. Only some errors will "
             + "raise this condition.  For those errors, the system will show a notification "
             + "by default.  You can use this event handler to prescribe an error "
             + "behavior different than the default.")
 public void ErrorOccurred(
     Component component, String functionName, int errorNumber, String message) {
   String componentType = component.getClass().getName();
   componentType = componentType.substring(componentType.lastIndexOf(".") + 1);
   Log.e(
       LOG_TAG,
       "Form "
           + formName
           + " ErrorOccurred, errorNumber = "
           + errorNumber
           + ", componentType = "
           + componentType
           + ", functionName = "
           + functionName
           + ", messages = "
           + message);
   if ((!(EventDispatcher.dispatchEvent(
           this, "ErrorOccurred", component, functionName, errorNumber, message)))
       && screenInitialized) {
     // If dispatchEvent returned false, then no user-supplied error handler was run.
     // If in addition, the screen initializer was run, then we assume that the
     // user did not provide an error handler.   In this case, we run a default
     // error handler, namely, showing a notification to the end user of the app.
     // The app writer can override this by providing an error handler.
     new Notifier(this).ShowAlert("Error " + errorNumber + ": " + message);
   }
 }
  @Override
  protected void onDestroy() {
    super.onDestroy();
    // for debugging and future growth
    Log.d(LOG_TAG, "Form " + formName + " got onDestroy");

    // Unregister events for components in this form.
    EventDispatcher.removeDispatchDelegate(this);
  }
 @SimpleEvent(
     description =
         "Event raised when another screen has closed and control has "
             + "returned to this screen.")
 public void OtherScreenClosed(String otherScreenName, String result) {
   Log.i(
       LOG_TAG,
       "Form "
           + formName
           + " OtherScreenClosed, otherScreenName = "
           + otherScreenName
           + ", result = "
           + result);
   EventDispatcher.dispatchEvent(this, "OtherScreenClosed", otherScreenName, result);
 }
 @SimpleEvent(description = "Screen orientation changed")
 public void ScreenOrientationChanged() {
   EventDispatcher.dispatchEvent(this, "ScreenOrientationChanged");
 }