datepicker - Android Date selector with only Day and Month -


I'm looking at the date selector to customize only to show day and month (i.e. any year) in Android .

I am creating a dialog based on this:

  dialog dlg = new date picture dialog (context, date picture listener, payment calendar.get (calendar.IEER) , Payment calendar. Gate (calendar. MONTH), DatedCalendar.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 day picker = new object (); Day picker = field. Get (DLG); (See day picker). Settension (see gene); }}} Hold (exception e) {// TODO: e.printStackTrace () should not be; } Return DLG;  

But on (I see) dayPicker) .setVisibility (View.GONE) A Cast exception is coming to an end;

java.lang.ClassCastException: Java .lang.String can not be molded into android.view.View

Any ideas?

After

let's go here its APIv11 + but there are other ways on lower API version.

  DatePickerDialog dlg = New DatePickerDialog (Reference, datePickerListener, dueDateCalendar.get (Calendar.YEAR), dueDateCalendar.get (Calendar.MONTH), dueDateCalendar.get (Calendar.DAY_OF_MONTH)); Int year = context.getResources () GetIdentifier ("android: id / year", null, null); If (years! = 0) {see Year Picture = DLG.JetDatePicture () SearchVBIID (year); If (salaried! = Null) {yearPicker.setVisibility (see gene); }} Return DLG;  

Updated code: This should work

  DatePickerDialog dlg = New DatePickerDialog (reference, datePickerListener, dueDateCalendar.get (Calendar.YEAR), dueDateCalendar.get (Calendar.MONTH), dueDateCalendar.get (Calendar.DAY_OF_MONTH)) {@Override protected void onCreate {bundled saved instenstate} {super.onCreate (SavedInstanceState); Integer year = getContext () getResources () .getIdentifier ("Android: ID / year", null, tap) ;. If (years! = 0) {see Year Picture = SearchWBIID (year); If (salaried! = Null) {yearPicker.setVisibility (see gene); }}}}; Return DLG;  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -