Search code examples
app-inventor

Push a button and then wait for another button


I am trying to make a Blackjack helping application in MIT App Inventor. I want the user to select the 2 cards that he has by clicking one button that maps to a card value and then click another one (could be the same button) and then take that input of 2 cards along with an input of 1 dealer card for processing. How can I click a button and then have it wait for another button to be pressed?


Solution

  • use a counter variable
    after clicking a button, add 1 to the counter
    after clicking again, add again 1 to the counter
    and only if counter = 2, then continue with your logic