How to dismiss AlertDialog.Builder on touch with no buttons
<p>When my alert pops up I want it to dismiss when it is touched again with out adding any buttons to it. </p>

<p>so on a map pin touch </p>

<pre><code>@Override
    protected boolean onTap(int i) {
        OverlayItem item = items.get(i);    
        dialog.setTitle(item.getSnippet());
        dialog.setMessage(item.getTitle());
        dialog.show();
        return (true);
    }
</code></pre>

<p>So how do I make it go away by touching any where in the alert or the background. </p>

<p><strong>EDIT:ADDED CODE</strong></p>

<pre><code> private class SitesOverlay extends ItemizedOverlay&lt;CustomItem&gt; {
private Drawable heart=null;
private List&lt;CustomItem&gt; items=new ArrayList&lt;CustomItem&gt;();
private PopupPanel panel=new PopupPanel(R.layout.popup);

public SitesOverlay() {
  super(null);

  heart=getMarker(R.drawable.heart_full);

  JSONObject json;
  JSONObject json2;
  String resultURL = queryRESTurl("http://www.kickintheapp.com/api/maps393/json.json");
  try {
      json = new JSONObject(resultURL);

  JSONArray nameArray = json.names();

  JSONArray valArray;

      valArray = json.toJSONArray(nameArray);


  for (int i = 0; i &lt; valArray.length(); i++) 
  {

      Log.e(nameArray.getString(i), valArray.getString(i));
      json2 = new JSONObject(valArray.getString(i));
      JSONArray nameArray2 = json2.names();

      JSONArray valArray2 = json2.toJSONArray(nameArray2);
      for (int a = 0; a &lt; valArray2.length(); a++) 
      {

          // add to maps here
          items.add(new CustomItem(getPoint(valArray2.getDouble(3),valArray2.getDouble(2)), valArray2.getString(1), valArray2.getString(0),getMarker(R.drawable.pin_yellow), heart));
          Log.e(nameArray2.getString(a), valArray2.getString(a));
      }
   }
  } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }

  populate();
}

@Override
protected CustomItem createItem(int i) {
  return(items.get(i));
}

@Override
public void draw(Canvas canvas, MapView mapView,
                  boolean shadow) {
  super.draw(canvas, mapView, shadow);

}

@Override
protected boolean onTap(int i) {
    OverlayItem item=getItem(i);
    GeoPoint geo=item.getPoint();
    Point pt=map.getProjection().toPixels(geo, null);

    View view=panel.getView();

    ((TextView)view.findViewById(R.id.latitude))
      .setText(item.getSnippet());
    ((TextView)view.findViewById(R.id.longitude))
      .setText(item.getTitle());

    panel.show(pt.y*2&gt;map.getHeight());

    return(true);
}

class PopupPanel {
   View popup;
   boolean isVisible=false;

 PopupPanel(int layout) {
   ViewGroup parent=(ViewGroup)map.getParent();

   popup=getLayoutInflater().inflate(layout, parent, false);

   popup.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
      hide();
    }
  });
}

View getView() {
  return(popup);
}

void show(boolean alignTop) {
  RelativeLayout.LayoutParams lp=new RelativeLayout.LayoutParams(
        RelativeLayout.LayoutParams.WRAP_CONTENT,
        RelativeLayout.LayoutParams.WRAP_CONTENT
  );

  if (alignTop) {
    lp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    lp.setMargins(0, 20, 0, 0);
  }
  else {
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.setMargins(0, 0, 0, 60);
  }

  hide();

  ((ViewGroup)map.getParent()).addView(popup, lp);
  isVisible=true;
}

void hide() {
  if (isVisible) {
    isVisible=false;
    ((ViewGroup)popup.getParent()).removeView(popup);
  }
 }
}
</code></pre>
