Hide day from datepicker
<p>I need hide the day field from a datepicker, I found this method, but the problems is in the version of Android 2.3.3, works fine, but in the version 4x of android not hides the day field. I guess is the library  "<em>java.lang.reflect.Field</em>" is obsolete , but I'm not sure of this.</p>

<p>I found this solution <a href="http://stackoverflow.com/questions/10793811/how-to-display-year-only-in-date-picker-in-android">here</a></p>

<p>may be going on here?</p>

<pre><code>final DatePicker datePicker = new DatePicker(this);                                     
                LLayout.addView(datePicker);

                hideDayField(datePicker, "mDayPicker");


    private void hideDayField(DatePicker datePicker, String name) {
    try {
        java.lang.reflect.Field field = DatePicker.class.getDeclaredField(name);
        field.setAccessible(true);
        View fieldInstance = (View) field.get(datePicker);
        fieldInstance.setVisibility(View.GONE);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
</code></pre>
