Display “Warning” and “Alert” box messages in App Inventor apps

Whether you use Windows, Linux or Mac OS X applications, when the program needs to alert the user (you!) to an issue, the program displays a pop up dialog box with a warning or error message. You can easily create similar warning messages in App Inventor, as shown in this example screen:

Screenshot_2014-09-08-14-05-48

To create a pop up warning dialog, use the Notifier control that appears in the Designer’s Palette:

NotifyPalette

Drag the Notifier icon into the app user interface design – the Notifier is used as a non-visible component, just below the user interface:

NotifyDesignerView

Switch to the Blocks view, click on the Notifier1 block to view the available methods. A partial list of methods is shown here – the item circled in red is the one we will use in this example:

NotifierMethods

In response to an on screen button press (btnNotifyUser’s Click event), the app displays the dialog message:

 

NotifyBlockCodeThis block can be inserted anywhere a processing block is allowed such as the result of an if-then-else conditional block. You can also change the text or background color of the app to something more interesting than the “black and white” default colors shown in this example.

Notifier provides a quick and easy way to display short alert messages to the user of the app.

 

17 thoughts on “Display “Warning” and “Alert” box messages in App Inventor apps”

  1. Very nice article. I need to offer a solution to test similar application which works on Bluetooth and via mobile the server-blutooth is configured manually.
    – how can we test such bluetooth applications,
    – any way to automate this setup on PC? testing this automatically. – – I’m student so please describe in detail.
    thanks.

    1. Alka, at this time, App Inventor lacks automated testing tools. It might be possible, I suppose, to run an app in the emulator and use an automated test tool that can then run an application automatically (say on Windows). But I have no idea if this would actually work. It is just an idea. And I have not looked in to trying to use Bluetooth feature in the emulator; Bluetooth might not work in the emulator. These are just some ideas and thoughts for further testing – for now, I am not aware of an existing automated test solution.

    1. Here is an answer to what I think you are asking:

      In the Blocks Editor, click on the button component located in the left hand column below “Screen1”. You will see a pop up menu of choices.

      Click on and drag the item labeled When buttonname.Click over to the Blocks Editor.

      Whenever the user presses the button, this “event” will be run. Put code inside this event handler to do what ever you want it to do.

      Let’s say you have two buttons: Button1 and Button2. You will add two event handler blocks, like

      When Button1.Click do

      and

      When Button2.Click do

      Put the code to do whatever you want them to do inside those event handler blocks.

      Ed

    2. Ok – now I see that this is about the Notifier? Sorry, I should have caught that.

      Add a When Notifier1.AfterChoosing event handler to your program. This eventhandler has a parameter named “choice”.

      Use “get choice” (just like a variable) to get the value of “choice“. The value will be exactly equal to the text of the button.

      If button 1 is “Okay” and button 2 is “Cancel”, when you press “Cancel”, the value of choice in the AfterChoosing eventhandler will be “Cancel”. Use an if-then comparison statement to determine which button was pressed and decide what action will be taken.

      Does that help?

      Ed

      1. I’m trying to do this: [When “buttonA” click do, call “notif1″ showChooseDialog”, message”?”, title “?”, button1Text”No”, button2Text”Yes”, cancelable”false”.] Then I want to call a number when the “yes” is selected, and close the window popup if the “No” is selected. But how?????? I tried to pick a [When notif1 AfterChoosing, choice do
        (1):call “XXX” MakePhoneCall
        (2): set choice to “Yes” then call “XXX” Make PhoneCall
        (3): and many other things but didn’t work….

        ((The (x): are the combinations I’we tried ))

        I’ve tried everything you said but it doesn’t work….
        Please help me!!

  2. I think this is the best website. Also, I think app inventor sucks doo doo, Visual Basic FTW!!

  3. Hi.Im a newbie..Im trying to do a messaging app for the past 1 week..but it shows “generic failure message not sent”..can u plz help me to sort this out??..I hav seen many sites and forums but the answer didnt do wel on mine..

    1. Hi Monika,
      Could you be more specific about what type of messaging app you are creating? Is this an app that uses email or something else to try and send a message?

      Ed

  4. Hello how to fix the error in app inventor 2 generated when trying to send more than one text msg at once, appears “generic failure, no message sent”

    1. Hello,
      I do not understand what you are trying to do – you are calling the Notifier and passing to it the text messages you want to display? And then it gives you an error “generic failure, no message sent”? That seems like an odd error.

      Ed

  5. hello
    thanks for this helpful tutorial. i need some help if it is possible and here is my question: iam trying to develop a small app by using mit appinventor but i cant find out how to do a popup list like a menu or an options list. so would you help me please to figure out how to do it because i’ve been trying different ways but it did not work.like this one on the link http://i.stack.imgur.com/uJGlW.png. thanks

Comments are closed.