title: Alertdialog with custom layout button
body: <p>I have a layout for my alertdialog.And there is a button to call timepicker.
  But I don't know how to write the button's setonClickListener.
  It always crashed.</p>
  
  <p><strong>FATAL EXCEPTION: main</strong></p>
  
  <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
          at prototype.feedme.cat.prototype.activity.CatActivity$3.onClick(CatActivity.java:115)
          at android.view.View.performClick(View.java:4756)
          at android.view.View$PerformClick.run(View.java:19749)
          at android.os.Handler.handleCallback(Handler.java:739)
          at android.os.Handler.dispatchMessage(Handler.java:95)
          at android.os.Looper.loop(Looper.java:135)
          at android.app.ActivityThread.main(ActivityThread.java:5221)
          at java.lang.reflect.Method.invoke(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:372)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
  </code></pre>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>private Button time;
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.CatActivity);
      time=(Button)findViewById(R.id.time);
      time.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              TimePickerDialog tpd=new TimePickerDialog(CatActivity.this, mTimesetlistener, mHour, mMinute, true);
              tpd.show();
          }
      });
      clk_btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              AlertDialog alertDialog=new AlertDialog.Builder(CatActivity.this)
                      .setTitle("Hi")
                      .setMessage("Are you ok?")
                      .setView(R.layout.notificaton_setting)
                      .show();
          }
      });
  }
  </code></pre>