title: How to update Activity's variable during AsyncTask?
body: <p>I'm trying to update a variable from AsyncTask, but I'm not exactly sure how. This is what I tried:</p>
  
  <p>Outside the AsyncTask is the activity class that has a variable..:</p>
  
  <blockquote>
  <pre><code>int myVariable = 0;
  MyTask hi = new MyTask ();
  hi.execute();
  System.out.print(myVariable);
  </code></pre>
  </blockquote>
  
  <pre><code>class MyTask extends AsyncTask&lt;Void, Void, Void&gt; {
  
          protected Void doInBackground(Void... args0) {
                      myVariable = 3;
              return null;
  
          }
      }
  </code></pre>
  
  <p>Still prints out 0 :(</p>
  
  <p>When i print out the variable, it still says 0, and not 3. I'm using AsynTask for something more complicated, but this is the dumbed down version of what I'm trying to accomplish.</p>