Misconception: Students transitioning from Scratch to AppInventor are often surprised to not have a wait block.

  • AppInventor is event driven, but doesn’t have a wait block.
    • In Scratch since the animation is contained within the Scratch software, one component can make another component wait.
      • That is to say that a scratch animation is not interacting with other system components.
    • App Inventor components are technically interacting with other Android system components like sensors.
      • This means they are not allowed to block other resources which means there can’t be a wait block.
    • More explanation: http://josmasflores.blogspot.com/2013/02/a-single-thread-of-execution-in-app.html
    • If necessary, you can simulate a wait using a timer.
      • Here is a google code forum discussing wait and timer in app inventor: https://code.google.com/p/app-inventor-for-android/issues/detail?id=37
  • Consider the following project that involves making a traffic light. Demonstrating a timer using a traffic light
    • The following Scratch code simulates delayed execution like you’d get with a wait block, but doesn’t block any resources when it is doing so. Delayed execution in Scratch without using a wait block

More about this tip

External Source

Interview with Krishnendu Roy.