title: Why do I always have to press the alert dialog button twice to close the dialog?
body: <p>The below alert dialog requires me to click whichever button I click twice in order to close the dialog window and after an hours googling, I can't find the answer. I am sure it is staring me in the face but I just can't see it. </p>
  
  <p>Edit: More searching has led me to believe the dialog is actually opened twice and it is occuring here: 
  asset_id_text_view.setOnTouchListener(new OnTouchListener() {
              @Override
              public boolean onTouch(View v, MotionEvent event) {</p>
  
  <pre><code>            showAssetIDDialog();
              return true;
          }
  
      });
  </code></pre>
  
  <p>Edit: started out with dialog.dismiss(); and some googling suggested trying dialog.cancel(); Neither of which were successful for me. </p>
  
  <pre><code>public void showAssetIDDialog() {
      // TODO Auto-generated method stub
      AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
              CreateTicketActivity.this);
  
      // set title
      alertDialogBuilder.setTitle("Enter Asset ID");
  
      alertDialogBuilder.setCancelable(true).setMessage(
              "How would you like to proceed?");
      alertDialogBuilder.setPositiveButton("Enter text",
              new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                      //enterTextDialog();
                      dialog.cancel();        
  
                  }
              });
      alertDialogBuilder.setNegativeButton("Cancel",
              new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                      dialog.cancel();
                  }
              });
  
      // create alert dialog
      AlertDialog alertDialog = alertDialogBuilder.create();
  
      // show it
      alertDialog.show();
  }
  </code></pre>