title: Android, AsyncTask, check status?
body: <p>This is my code:</p>
  
  <p>In onCreate:   </p>
  
  <pre><code> new LoadMusicInBackground().execute();
  </code></pre>
  
  <p>Then towards the end of my main class I have this code</p>
  
  <pre><code>/** Helper class to load all the music in the background. */
  class LoadMusicInBackground extends AsyncTask&lt;Void, String, Void&gt; {
      @Override
      protected Void doInBackground(Void... unused) {
  
          soundPool = new SoundPool(5, AudioManager.STREAM_MUSIC, 100);
          soundPoolMap = new HashMap&lt;Integer, Integer&gt;();
  
          soundPoolMap.put(A1,
                  soundPool.load(GameScreen_bugfix.this, R.raw.a, 1));
          soundPoolMap.put(A3,
                  soundPool.load(GameScreen_bugfix.this, R.raw.b, 1));
          soundPoolMap.put(A5,
                  soundPool.load(GameScreen_bugfix.this, R.raw.c_s, 1));
          soundPoolMap.put(A6,
                  soundPool.load(GameScreen_bugfix.this, R.raw.d, 1));
          soundPoolMap.put(A8,
                  soundPool.load(GameScreen_bugfix.this, R.raw.e, 1));
          soundPoolMap.put(A10,
                  soundPool.load(GameScreen_bugfix.this, R.raw.f_s, 1));
          soundPoolMap.put(A12,
                  soundPool.load(GameScreen_bugfix.this, R.raw.g_s, 1));
          soundPoolMap.put(wrong,
                  soundPool.load(GameScreen_bugfix.this, R.raw.wrong2, 1));
  
          publishProgress("");
          Log.v("SOUNDPOOL", "" + soundPoolMap);
          return (null);
      }
  
      @Override
      protected void onProgressUpdate(String... item) {
          // text1.setText(item[0]);
      }
  
      @Override
      protected void onPostExecute(Void unused) {
          //Toast.makeText(GameScreen_bugfix.this, "music loaded!", Toast.LENGTH_SHORT).show();
      }
  }
  </code></pre>
  
  <p>If the music has not loaded I am getting a nullpointer exception, looking at the docs I see there is a getStatus() but I have tried something like this:</p>
  
  <pre><code>music_load_status=LoadMusicInBackground.getStatus()
  </code></pre>
  
  <p>and that is not working :(
  How do I check if the background task is complete and the music has loaded?</p>
  
  <p>Thanks!<br>
  Ryan</p>