title: TimePickerDialog and TimePicker
body: <pre><code>onCreate(...) {
  ...
  showDialog(TIME_DIALOG_ID);
  timePicker = (TimePicker) findViewById(R.id.timePicker);
  timePicker.setIs24HourView(true);
  ...
  Button btnOpen = (Button) findViewById(R.id.btnSet);
  btnOpen.setOnClickListener(new View.OnClickListener() {
       public void onClick(View v) {
          Toast.makeText(getBaseContext(),
                         “Time selected:” +
                         timePicker.getCurrentHour().toString() +
                         “:” + timePicker.getCurrentMinute().toString(),
                         Toast.LENGTH_SHORT).show();
       }
  }
  
  onCreateDialog(...) {
      return new TimePickerDialog(...)
  }
  </code></pre>
  
  <p>Above is a code sample from an Android book. I was wondering how timePicker knows the current hour and current minute. timePicker is only defined in onCreate. When onCreateDialog is called with showDialog(), it returns a TimePickerDialog that in no way seems to know about timePicker, yet timePicker is able to get the current hour and minute to toast it.</p>