title: Android Studio - How to dismiss dialog box
body: <p>Just wondering how I would dismiss the dialog box when an option is selected.</p>
  
  <p>Here is the code</p>
  
  <pre><code>public boolean onOptionsItemSelected(MenuItem item) {
      super.onOptionsItemSelected(item);
  
      if (item.getItemId() == R.id.launch_voip_call) {
          Utils.startCall(this, contact);
          return true;
      } 
      else if(item.getItemId() == R.id.launch_attachment){
  
          AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
          dialogBuilder.setCancelable(true);
  
          View choiceView = getLayoutInflater().inflate(R.layout.dialog_image_source_chooser, null);
  
          ImageButton cameraButton = (ImageButton) choiceView.findViewById(R.id.cameraButton);
  
          ImageButton galleryButton = (ImageButton) choiceView.findViewById(R.id.galleryButton);
  
          cameraButton.setOnClickListener(new View.OnClickListener() {
  
              public void onClick(View v) {
                  Intent cameraIntent = new Intent(SingleConversationActivity.this, CameraActivity.class);
                  cameraIntent.putExtra("EXTRA_CONTACT_JID", contact.getJid());
                  startActivity(cameraIntent);
  
              }
          });
  </code></pre>