title: Perform AsyncTask inside Class
body: <p>I have a method inside of a class called </p>
  
  <pre><code>ChopraWisdom.GetQuote()
  </code></pre>
  
  <p>that pulls in some data from the interwebs. To use it I have to use an AsyncTask in my activity. Thats fine and all, but my Activity code now gets cluttered with the AsyncTask code.</p>
  
  <p>I was hoping that I could hide the AsyncTask in my Class and then create another method called</p>
  
  <pre><code>ChopraWisdom.GetQuoteAsync()
  </code></pre>
  
  <p>But I'm not sure how to pass in "Actions" (I come from a .Net background) in order to handle the various UI updating that needs to take place.</p>
  
  <p>In C# I would define the method signature as something like:</p>
  
  <pre><code>ChopraWisdom.GetQuoteAsync(Action preExecute, Action postExecute, Action updateProgress)
  </code></pre>
  
  <p>Questions:</p>
  
  <ol>
  <li>Does java have something comparable to 'Action'?</li>
  <li>What is the acceptable pattern for 'wrapping' Async functionality like this in Java? </li>
  <li>I like clean code, but am I being to picky here?</li>
  </ol>
  
  <p>Please provide examples.</p>
  
  <p><strong>EDIT - Added Example class</strong></p>
  
  <pre><code>public class ChopraWisdom
  {
       public string GetQuote()
       {
          //...do stuff and return a string
       }
  }
  </code></pre>