Dialog by single method call
<p>I'm new to Java/Android developing, and I have the habit of creating a tool library when learning a new platform, where I put functions for very common tasks. In this case, an OK/Cancel-Dialog.</p>

<p>What I want to achieve is something like this:</p>

<pre><code>if (tools.ask("Are you sure")) {
   //do something
}
else {
   //don't do it
}
</code></pre>

<p>tools.ask() should create and display an OK/Cancel-Dialog, if user clicks OK returns true, otherwise (cancel clicked, backbutton clicked, application terminated, whatever) returns false.</p>

<p>I looked into AlertDialog, and I know how to implement this with X lines of code. But since this is event driven I have no idea about how to put this in a method with a return value.</p>

<p>Is it even possible?</p>

<p>Thanks in advance!</p>
