Notifier

Last Updated On 2021-07-16

Version 6MinSDK 7Tutorial Video

The Notifier component displays alert dialogs, messages, and temporary alerts, and creates Android log entries through the following methods:

  • ShowMessageDialog: displays a message which the user must dismiss by pressing a button.
  • ShowChooseDialog: displays a message two buttons to let the user choose one of two responses, for example, yes or no, after which the AfterChoosing event is raised.
  • ShowTextDialog: lets the user enter text in response to the message, after which the AfterTextInput event is raised.
  • ShowPasswordDialog: lets the user enter password in response to the message, after which the AfterTextInput event is raised.
  • ShowAlert: displays a temporary alert that goes away by itself after a short time.
  • ShowProgressDialog: displays an alert with a loading spinner that cannot be dismissed by the user. It can only be dismissed by using the DismissProgressDialog block.
  • DismissProgressDialog: Dismisses the progress dialog displayed by ShowProgressDialog.
  • LogError: logs an error message to the Android log.
  • LogInfo: logs an info message to the Android log.
  • LogWarning: logs a warning message to the Android log.
  • The messages in the dialogs (but not the alert) can be formatted using the following HTML tags:<b>, <big>, <blockquote>, <br>, <cite>, <dfn>, <div>, <em>, <small>, <strong>, <sub>, <sup>, <tt>. <u>
  • You can also use the font tag to specify color, for example, <font color="blue">. Some of the available color names are aqua, black, blue, fuchsia, green, grey, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow


Properties

You can set the below properties in the UI part of the builder.

  • BackgroundColor - it's a color value which is set to &hff444444 by default.
  • NotifierLength - it's a toast length value which is set to 1 by default.
  • TextColor - it's a color value which is set to &hffffffff by default.

Block Properties

You can set the below blocks properties in the blocks section of the builder.

BackgroundColor

Specifies the background color for alerts (not dialogs).


TextColor

Specifies the text color for alerts (not dialogs).



Methods

You can set the below method blocks in the blocks section of the builder.

AddToolTip

Sets tooltip for components

CreateCustomDialog

Shows a custom dialog from a layout or cmponent

DismissChooseDialog

Dismiss the choose dialog

DismissCustomDialog

Dissmissed the custom dialog

DismissProgressDialog

Dismiss a previously displayed ProgressDialog box

LogError

Writes an error message to the Android system log. See the Google Android documentation for how to access the log.

LogInfo

Writes an information message to the Android log.

LogWarning

Writes a warning message to the Android log. See the Google Android documentation for how to access the log.

ShowAlert

Display a temporary notification.

ShowChooseDialog

Shows a dialog box with two buttons, from which the user can choose. If cancelable is true there will be an additional CANCEL button. Pressing a button will raise the AfterChoosing event. The "choice" parameter to AfterChoosing will be the text on the button that was pressed, or "Cancel" if the CANCEL button was pressed.

ShowCustomDialog

Show the custom dialog

ShowMessageDialog

Display an alert dialog with a single button that dismisses the alert.

ShowPasswordDialog

Shows a dialog box where the user can enter password (input is masked), after which the AfterTextInput event will be raised. If cancelable is true there will be an additional CANCEL button. Entering password will raise the AfterTextInput event. The "response" parameter to AfterTextInput will be the entered password, or "Cancel" if CANCEL button was pressed.

ShowProgressDialog

Shows a dialog box with an optional title and message (use empty strings if they are not wanted). This dialog box contains a spinning artifact to indicate that the program is working. It cannot be canceled by the user but must be dismissed by the App Inventor Program by using the DismissProgressDialog block.

ShowTextDialog

Shows a dialog box where the user can enter text, after which the AfterTextInput event will be raised. If cancelable is true there will be an additional CANCEL button. Entering text will raise the AfterTextInput event. The "response" parameter to AfterTextInput will be the text that was entered, or "Cancel" if the CANCEL button was pressed.


Events

You can set the below event blocks in the blocks section of the builder.

AfterChoosing

Event after the user has made a selection for ShowChooseDialog.

AfterTextInput

Event raised after the user has responded to ShowTextDialog.

ChoosingCanceled

Event raised when the user canceled ShowChooseDialog.

TextInputCanceled

Event raised when the user canceled ShowTextDialog.