title: Android onClickListner on AlertDialog not working
body: <p>I am trying to create a popup that has a custom view composed out of a scroll view, a text view and two buttons at the end of the text. The user has to scroll down and after that press the Yes button ( to accept the terms and conditions, this is the scope ).</p>
  
  <p>On the onCreateView of that fragment I have:</p>
  
  <pre><code>        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
      View customView = inflater.inflate(R.layout.terms, container, false);
      Button yes_btn = (Button) customView.findViewById(R.id.btn_yes);
      builder.setView(customView);
      final AlertDialog termsdialog = builder.create();
      yes_btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Log.d("adsa", "asdada");
              termsdialog.dismiss();
          }   
      });
      builder.show();
      return rootView;
  </code></pre>
  
  <p>I cannot understand why the onClick method is not called. My goal is to close the pop-up once the user selects Yes.</p>
  
  <p>Thanks!</p>