title: How to use xml timepicker?
body: <p>I have dialog button and timepicker created in the same xml code below:</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_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
      &lt;TimePicker
          android:id="@+id/timePicker1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
          &lt;LinearLayout android:id="@+id/LinearLayout02" android:layout_height="wrap_content" android:layout_width="fill_parent"&gt;
              &lt;Button android:layout_height="wrap_content" android:id="@+id/dialog_ok" android:text="OK" android:layout_width="fill_parent" android:layout_weight="1"&gt;&lt;/Button&gt;
              &lt;Button android:layout_height="wrap_content" android:text="Cancel" android:id="@+id/dialog_cancel" android:layout_width="fill_parent" android:layout_weight="1"&gt;&lt;/Button&gt;
          &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And then i created dialog in java code and also bring in the dialog and timepicker from xml code as showen below:</p>
  
  <pre><code>public void TimePickerDialog(){
      final Dialog dialog = new Dialog(this);
  
      dialog.setContentView(R.layout.sign_in_dialog);
  
  /////////////////////updated code////////////////////
    TimePicker timePicker1 = (TimePicker) findViewById(R.id.timePicker1);
  
     timePicker1.setIs24HourView(true); 
  /////////////////////////////////
  
      dialog.setTitle("Quick Mute");
  
      //Allow the dialog to be cancelable
      dialog.setCancelable(true);
      // Here we add functionality to our dialog box's content. In this example it's the two buttons
      //reference the button
      Button okButton = (Button) dialog.findViewById(R.id.dialog_ok);
      //Create a click listener
      okButton.setOnClickListener(new OnClickListener() {
           //override the onClick function to do something
           public void onClick(View v) {
  
           }
      });
  
      //reference the button
      Button cancelButton = (Button) dialog.findViewById(R.id.dialog_cancel);
      //Create a click listener
      cancelButton.setOnClickListener(new OnClickListener() {
           //override the onClick function to do something
           public void onClick(View v) {
            //Close the dialog&lt;/span&gt;
                    dialog.dismiss();
          }
      });
      //finally show the dialog   
      dialog.show();
  }
  </code></pre>
  
  <p>The problem i have is how do i get access to the timepicker that was created in xml code so that i can make the timepicker 24 hour timepicker? ... and also how do i get the time from the timepicker that is in xml code?</p>