title: Android: Date Picker using xml layout
body: <p>I tried to display date picker using xml code. But it did not display anything. Can I display DatePicker only through java code?</p>
  
  <h2>datePickerExample.java</h2>
  
  <pre><code>public class datePickerExample extends Activity
  {
      @Override
      public void onCreate(Bundle savedInstanceState) 
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.date_picker_example); 
      }
  }
  </code></pre>
  
  <h2>date_picker_example.xml</h2>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/lay_main"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:background="@drawable/bg" &gt;
  
      &lt;TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="Date : " &gt;
      &lt;/TextView&gt;
  
      &lt;DatePicker
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:endYear="2100"
          android:startYear="1900" &gt;
      &lt;/DatePicker&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Thank you...</p>