Reputation: 506
I wish to add a Calendar object to the ParseObject I have created but its throwing an exception whenever I try to add it:
ParseObject route = new ParseObject(ParseConstants.CLASS_ROUTES);
route.put(ParseConstants.KEY_ROUTE_PROPOSED_TIME, mProposedDateTime);
09-05 12:57:55.735 16977-16977/com.khackett.runmate E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.khackett.runmate, PID: 16977
java.lang.IllegalArgumentException: invalid type for value: class java.util.GregorianCalendar
I am getting the Calendar object from the previous intent as follows:
mProposedDateTime = (Calendar) getIntent().getSerializableExtra("proposedTime");
What is the recommended way to add a Calendar object to Parse?
Upvotes: 2
Views: 91
Reputation: 2013
At Parse you need a Date object, for accomplish this you must call getTime()
like this:
route.put(ParseConstants.KEY_ROUTE_PROPOSED_TIME, mProposedDateTime.getTime());
Upvotes: 2