title: How to display Toast in Android?
body: <p>I have a slider that can be pulled up and then it shows a map. I can move the slider up and down to hide or show the map. When the map is on front, I can handle touch events on that map. Everytime I touch, a <code>AsyncTask</code> is fired up, it downloads some data and makes a <code>Toast</code> that displays the data. Although I start the task on touch event no toast is displayed, not till I close the slider. When the slider is closed and the map is not displayed anymore the <code>Toast</code> appears.</p>
  
  <p>Any ideas?</p>
  
  <p>Well start the task</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>public boolean onTouchEvent(MotionEvent event, MapView mapView){ 
      if (event.getAction() == 1) {
          new TestTask(this).execute();
          return true;            
      }else{
          return false;
      }
   }
  </code></pre>
  
  <p>and in <code>onPostExecute</code> make a toast</p>
  
  <pre><code>Toast.makeText(app.getBaseContext(),(String)data.result, 
                  Toast.LENGTH_SHORT).show();
  </code></pre>
  
  <p>In new <code>TestTask(this)</code>, this is a reference to <code>MapOverlay</code> and not to <code>MapActivity</code>, so this was the problem.</p>