title: Android: How to update an UI from AsyncTask if AsyncTask is in a separate class?
body: <p>I hate inner class.</p>
  
  <p>I've a main activity who launches a 'short-life' AsyncTask.</p>
  
  <p>AsyncTask is <strong>in a separate file</strong>, is not an inner class of main activity</p>
  
  <p>I need async task updates a textView from main Activity.</p>
  
  <p>I know i can update a TextView from onProgressUpdate, if AsyncTask is a inner class</p>
  
  <p>But how from an external, indipendent, async task ?</p>
  
  <p>UPDATE: This looks like working :</p>
  
  <p>In acitivty i call the task</p>
  
  <pre><code>backgroundTask = new BackgroundTask(this);
  backgroundTask.execute();
  </code></pre>
  
  <p>In the constructor i've </p>
  
  <pre><code>public BackgroundTask(Activity myContext)
  {
      debug = (TextView) myContext.findViewById(R.id.debugText);
  }
  </code></pre>
  
  <p>where debug was a private field of AsyncTask.</p>
  
  <p>So onProgressUpdate I can </p>
  
  <pre><code>debug.append(text);
  </code></pre>
  
  <p>Thanks for all of you suggestions</p>