title: How to configure custom button in dialog?
body: <p>here I have a custom dialog with background 2 ImageButton inside it.
  the problem is, when I try to set onclick listener to that buttons, the program will return NullPointerException. I don't know why is this happen. how to assign operation to button inside dialog anyway??</p>
  
  <p>pause menu xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:background="@drawable/pause_menu_cropped" android:layout_gravity="center" android:gravity="center|center_horizontal"&gt;
      &lt;TableLayout android:layout_width="wrap_content" android:id="@+id/tableLayout1" android:layout_height="wrap_content"&gt;
          &lt;ImageButton android:src="@drawable/pause_button_option" android:layout_width="wrap_content" android:background="@drawable/pause_button_option" android:layout_height="wrap_content" android:id="@+id/btn_pause_option"&gt;&lt;/ImageButton&gt;
          &lt;ImageButton android:src="@drawable/pause_button_quit" android:layout_width="wrap_content" android:background="@drawable/pause_button_quit" android:layout_height="wrap_content" android:id="@+id/btn_pause_quit"&gt;&lt;/ImageButton&gt;
      &lt;/TableLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>dialog code </p>
  
  <pre><code>        Dialog pauseMenu = new Dialog(this, R.style.NewDialog);
      pauseMenu.setContentView(R.layout.pause_menu);
  
    ImageButton quit = (ImageButton)findViewById(R.id.btn_pause_quit);
    quit.setOnClickListener(
            new OnClickListener() {
  
        @Override
        public void onClick(View v) {
            TestActivity.this.finish();
        }
    });
      return pauseMenu;
  </code></pre>
  
  <p>the code is returning error in line</p>
  
  <pre><code>quit.setOnClickListener();
  </code></pre>