java - CalendarView.setTime issues -


I have issues trying to use .setTime on the calendar ops object, see the code below.

  package com.example.calendar_test; Import java.util.Calendar; Import java.util.Date; Importroid.os.Bundle; Import android App Import android.content.Context; Import android.text.format.DateFormat; Import android.text.format.Time; Import android.view.Menu; Import android.view.View; Import android.widget.CalendarView; Import android.widget.Toast; Import android.widget.CalendarView.OnDateChangeListener; Public class enhances main activity activity (calendar view cv; @ override protected zero to create the constellation (InstantState saved from bundle) {late start date; super.onCreate (savedInstanceState); setContentView (R.layout.activity_main); Cv = ( Calendar view) this.findViewById (android.R.id.content) .findViewById (R.id.calendarView1); StartDate = cv.getDate (); cv.setDate (cv.getDate ()); last reference reference = this; cv .setOnDateChangeListener (New OnDet Change Listener) {Cancel Selected Selected on Public Selection (View Calendar View, Int Year, Int. Sine, Int Dayoffmonth) {Date from date = New date (date); Seledet .setMonth (Month); Sladet; Sets year (Year); Set date (Day of Fame); Seledayet. Settime (Settteet.Gate Time)); View .setdate (selDate.getTime ()); Date d = new date (); D.setMonth (2); D.Set Year (2014); D.setDate (22); d.setTime (d.getTime ()) ; If (view.getDate () == d.getTime ()) {Toast. Make Text (context, "You hit 22", Toast. LNNGHIHORT). Show ();}}}); } @ Override Public Boolean On Crate Option Menu (Menu Menu) {// Enhancing Menu; It adds the item to the Action Bar if it exists GetMenuInflater (). Fluo (R. menu menu, menu); Back true; }}  

When I run I get this message when choosing a message I 02-17 15: 50: 30.501: e / messageQueue -JNI (10 9): java. Lang.IllegalArgumentException: Mon Jan 01 00:00:00 EST 1900 and Friday December 31 00:00:00 EST is not between 2100

Scene. Setting (SLAD .getTime ()) Blown on Used to be;

I do not quite understand why selDate.getTime () is not valid for viewing .setDate ()

Anyone?

When you create date item, its year value current year is zero to 1900. It is a valid value to calculate milliseconds after 1 January 1970, 00:00:00. When you modify the year object year object year value from the logic code, these are outside the Missed limit, because that Year In the logic list, only the current year (zero to 1900)

should replace you

selDate.setYear (year); and selDate.setYear (2014);

with

selDate.setYear (year-1900); and selDate.setYear (114);


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 -