title: Android managging monitors concurrency with buttons
body: <h1>Context</h1>
  <p>I need to manage the concurrency of an app. I declared a <code>Object sync</code> to use monitors on that object.</p>
  <p>The main goal is that the first button, <code>A</code>, will execute some code, but, when reaching some points, it needs button <code>B</code> to be clicked to be able to continue. Something like this:</p>
  <p><img src="https://i.stack.imgur.com/Z9RPm.jpg" alt="Flow demo" /></p>
  <h1>Issues</h1>
  <p>The issue is that the <code>B</code> button can't be clicked, I guess it's because the UI thread is stuck waiting for the code of button <code>A</code> to be fully executed before raising other button events.</p>
  <p>If I execute the code in button <code>A</code> in a new <code>Thread</code>, when I try to update the <code>View</code> (called <em>UI</em> in the drawing), I get <code>CalledFromWrongThreadException</code>.</p>
  <h1>Edit</h1>
  <p>I solved it adding a <code>Handler</code> for the UI update and the already added <code>Thread</code> for the code in <code>A</code>.</p>