title: Android: Call AsyncTask inner class from a separate Class File
body: <p>I have a Class: TabsPagerFragmentActivity which hosts all of the tabs.</p>
  
  <p>I then have a separate class: ShopsFragment which has an inner class which extends AsyncTask</p>
  
  <p>I'm trying to call the .execute method on this inner class from the TabsPagerFragmentActivity however i'm getting a</p>
  
  <pre><code> No enclosing instance of the type is accessible error.
  </code></pre>
  
  <p>Is there a way to call this inner class execute from the TabsPagerFragmentActivity?
  Basically i'm trying to change an image as soon as the user leaves this fragment.</p>
  
  <p>Code:</p>
  
  <pre><code>public class AlternateImageView extends AsyncTask&lt;String,Integer,Void&gt;{
  
          @Override
          protected Void doInBackground(String... params) {
  
              return null;
          }
  
          @Override 
          protected void onProgressUpdate(Integer... progress) {
  
          }
  
          @Override
          protected void onPostExecute(Void v) {
                         //Do something 
                  }
           }
  </code></pre>
  
  <p>Thanks</p>