title: How to display toast in AsyncTask
body: <p>I want to display toast message in doInBackground as follows.</p>
  
  <pre><code>private class myAsync extends AsyncTask&lt;Void, Integer, Void&gt;
  {
      int duration = 0;
      int current = 0;
      int inc = 0;
  
      @Override
      protected Void doInBackground(Void... params) {
  
          videoView.start();
          videoView.setOnPreparedListener(new OnPreparedListener() {
  
              public void onPrepared(MediaPlayer mp) {
  
                  duration = videoView.getDuration();
  
              }
          });
  
          do {
              current = videoView.getCurrentPosition();
              inc = inc + 1;
  
              if(inc == 10000 || inc == 25000 || inc == 30000){
                  Toast.makeText(getApplicationContext(), inc, Toast.LENGTH_LONG).show();
              }
         } while (current &lt;= duration);          
  
          return null;
      }
  
      @Override
      protected void onProgressUpdate(Integer... values) {
          super.onProgressUpdate(values);
          Toast toast = Toast.makeText(getApplicationContext(),values[0], Toast.LENGTH_LONG);
          toast.setGravity(Gravity.CENTER, 0, 0);
          toast.show();
      }
  }
  </code></pre>
  
  <p>I want to display the inc value when it is 10000, 25000, 30000.</p>
  
  <p>I hope someone who knows this help me.</p>
  
  <p>Thanks</p>