Crazy notifiers

I'm trying to code the password screen to allow the user to set/change the password using 2 notifiers in nested IF-THENs. (To verify it was typed correctly.) The problem is that sometimes it opens the second before the first. I can't figure out the trigger as it isn't consistent. It often alternates (one correct, one backwards), but it has gone 3 corrects in a row.

Any thoughts?

Please show your relevant blocks

I was afraid someone was going to ask that. Not sure how to do that except by PrintScreen.

Ok, here's the logic. If text password is not equal password then error message and exit. else notifier1 gets new password which is stored in NewPW1. (ShowAlert is for debugging). If NewPW1 is cancel, exit; if not, Notifier2 gets second password and it's put in NewPW2. If Newpw2 is cancel, exit, if not equal cancel, if NewPW1 & 2 are same save new password, else error message. Exit.

I know there are other bugs and inefficiencies. I think I have to re-load PW from TinyDB but I haven't gotten that far. And I think I can detanglify the "if" structure,too.

First question... why...? :wink:

I think you need to get a better handle on your workflow, not quite sure what you are trying to achieve? Either the password is OK, or user wants to change their password?

You need to move some of your blocks to the after textInput blocks, otherwise the logic will not flow properly.

On the password screen is the option to add or change the password. Rather than create another screen, a pop-up window asks for the new password. Since it seems all invocations of a notifier are linked to the same test output, to get a second instance of the password to verify it was typed correctly (which is SOP with most programs) I have to use 2 notifiers, one for each input of new password. Only if the 2 match (NewPW1 and 2) is the new password saved. The limitations of the block If's (or my limitations on how to use them) makes it rather unwieldy as and needs to be streamlined as I acknowledged in my previous post.

I would try it without a notifier at all, you should be able to program a textbox to appear for the second password entry when needed (with accompanying logic to compare the two textboxes)

like hidden. Make visible, use them and hide again.

Notifiers are confusing. I put a password dialog and a show alert in a The show alert shows before I type the password. AHHHH. I think I read about this. It's because of the way App Inventors ques actions. The ShowAlert is already in the cue (however you spell it) when the AfterTextInput event is triggered, so it is done first. And that's what's happening in what's here. It follows the logic path before it has the values it's supposed to evaluate. Then the second time it runs using the values left over from the previous time.

ya know, Ida thought a text input dialog box would pause program flow. But then again it doesn't matter since you can only process the input at the end of the routine. Which means you have to run an input notifier and then end the routine and run another after text is input. Is this "branchless" characteristic true of all Android apps, or just the App Inventor?

It is about positioning.....


got it


A note to anyone who might find this later. I found others who had similar problems and, while "solved" there were no clear explanations for what appeared to be erratic behavior. I think this article explains it well.


thanks for the article... really helpful :+1:

see also The model of event processing in App Inventor by @Franklyn_A_Turbak

Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.