Setting max date in calenderView to a specific date
I have the following code CalendarView cal = (CalendarView) findViewById(R.id.calendarView); cal.setMaxDate(); cal.setMinDate(System.currentTimeMillis() - 1000); I'm not sure how to format a date to put in setMaxDate, it says it wants a long data type? How would I format 31/12/2016 for example?
setMaxDate expects a number of milliseconds since the epoch (see javadoc). One way to do it would be: SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd"); Date maxDate = sdf.parse("2016-12-31"); cal.setMaxDate(maxDate.getTime()); Or you could use a Calendar (untested but probably more efficient): Calendar c = Calendar.getInstance(); c.clear(); c.set(2016, Calendar.DECEMBER, 31); cal.setMaxDate(c.getTimeInMillis());
Is my activity being leaked - and is it the ActionBar that's doing it?
Cant figure out why the JUnit test case is failing
How to build an array recursively
Placing buttons under the combo box
windows xp 32-bit netbeans issues
Calling Java class/method using command line
Best Java GUI performance on Raspberry PI
Array Value assign in java array? [closed]
Parse a String to obtain id numbers [closed]
Getting ArrayIndexOutOfBoundsException and not sure why
Creating JAR files programmatically - Adding files to specific folder inside jar
JFreeChart stepped, 'staggerable', area/ line chart
How to get Session id after validating a user in Restful service?
How to get encoded data sent in form of bytes using body and convert to JSON?
Naming.lookup fails with Java WebStart
Can gateway serve as a dispatcher?