title: Custom Dialog onClickListener
body: <p>So I have a custom Dialog that opens when user clicks on CardView. When the dialog is opened it lets the user to select one option and then opens a new activity.</p>
  
  <p>The problem is, I can't set onClickListener to Dialog, and when I try to set onClickListener to TableRow (Dialog is from custom layout that has TableRows) I get NullPointerException on line <code>dialogHomeScreenOpcenitoUrediSve.setOnClickListener(new View.OnClickListener() {</code></p>
  
  <p>Here's my code:</p>
  
  <pre><code>karticaMainScreenOpcenitoGrid.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  final Dialog dialog = new Dialog(AppLayoutMain.this);
                  dialog.setContentView(R.layout.content_home_screen_opcenito_dialog);
                  dialog.setTitle(getResources().getString(R.string.dialog_tumacenje_programa_naslov));
                  dialogHomeScreenOpcenitoUrediSve = (TableRow) findViewById(R.id.dialogHomeScreenOpcenitoUrediSve);
                  dialogHomeScreenOpcenitoUrediSve.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          Intent i = new Intent(AppLayoutMain.this, StatistikeInputMain.class);
                          startActivity(i);
                      }
                  });
  
                  dialog.show();
  
              }
  
          });
  </code></pre>
  
  <p>Any solution?</p>