title: Android Date selector with only Day and Month
body: <p>I am looking for a way to customize the Date selector in Android to only show the day and month (i.e. no year).</p>
  
  <p>I am creating a dialog based on <a href="https://stackoverflow.com/questions/4122929/how-to-display-date-picker-for-android-with-only-month-and-year-fields">How to display date picker for android with only month and year fields?</a>:</p>
  
  <pre><code>    Dialog dlg = new DatePickerDialog(context, datePickerListener, dueDateCalendar.get(Calendar.YEAR), dueDateCalendar.get(Calendar.MONTH), dueDateCalendar.get(Calendar.DAY_OF_MONTH));
      try {
          Field f[] = dlg.getClass().getDeclaredFields();
          for (Field field : f) {
              String name = field.getName();
              if (name.equals("YEAR")){
                  field.setAccessible(true);
                  Object dayPicker = new Object();
                  dayPicker = field.get(dlg);
                  ((View) dayPicker).setVisibility(View.GONE);
              }
          }
      } catch (Exception e){
          // TODO: should not happen
          e.printStackTrace();
      }
      return dlg;
  </code></pre>
  
  <p>But I keep getting a Cast exception on ((View) dayPicker).setVisibility(View.GONE);</p>
  
  <blockquote>
    <p>java.lang.ClassCastException: java.lang.String cannot be cast to
    android.view.View</p>
  </blockquote>
  
  <p>Any ideas?</p>