Handling quick succession taps on overlay items
<p>I have created a map application to show near by places on the map.When the user clicks on the pin on the map a Alert dialog box pops up asking user to show the route.My problem is that when the pin is clicked many times at quick succession the message box is appearing more than once.I don't want that message to appear more than once.Can anyone help me in this? My code is:</p>

<pre><code>    protected boolean onTap(int pos) {

    final ProgressDialog myDialog = ProgressDialog.show(LocationBasedServicesV1.this, "", "Please Wait...");
         OverlayItem item = items.get(pos);
          Thread backgroundThread = new Thread(new Runnable(){
        @Override
        public void run() {
             runOnUiThread(new Runnable() {                    
             @Override
              public void run() {
                 AlertDialog.Builder dialog = new AlertDialog.Builder(  LocationBasedServicesV1.this);
                dialog.setTitle(listDetailsVO.getName());
                dialog.setMessage("Address: "+destination+"\nPhone: "+finalPhone+"\nEmail Id: "+finalEmail+"\nDistance: "+finalDistance+unit);
                dialog.setPositiveButton("Show Route", new DialogInterface.OnClickListener(){
                @Override
                public void onClick(DialogInterface arg0, int arg1) {
                    try {
                        Intent i = new Intent(LocationBasedServicesV1.this, ShowRouteActivity.class);
                        i.putExtra("destination", destination);
                        i.putExtra("source", currentAddress);
                        startActivity(i);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
            });
            dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener(){
            @Override
            public void onClick(DialogInterface dialog, int which) {
            }
           });
         dialog.show();
         }
        }); 
        myDialog.dismiss();
        }
        });
        backgroundThread.start();
    }
</code></pre>
