I developed a reservation application, and the back end of the application through Analysis. For some reason, the updated information in Parse is completely different from what appears in the application when it passes through the emulator. E.g. my StartTime (Date) is April 14, 2015, 19:00, and my EndTime (Date) is April 14, 2015, 20:00. However, when I run the application, the event is on a different date and time. Can anybody help me?
private void makeWebCallToParse() {
ParseQuery<ParseObject> query = ParseQuery.getQuery("GymSession");
query.findInBackground(new FindCallback<ParseObject>() {
@SuppressWarnings("deprecation")
@Override
public void done(List<ParseObject> objects, ParseException e) {
if(e == null) {
for(int i = 0; i < objects.size(); i++) {
WeekViewEvent event = new WeekViewEvent();
event.setName(objects.get(i).getString("GymSession"));
event.setId(i);
event.setParseObjectId(objects.get(i).getObjectId());
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_WEEK, objects.get(i).getDate("StartTime").getDay());
cal.set(Calendar.DAY_OF_MONTH, objects.get(i).getDate("StartTime").getMonth());
cal.set(Calendar.DAY_OF_YEAR, objects.get(i).getDate("StartTime").getYear());
cal.set(Calendar.MINUTE, objects.get(i).getDate("StartTime").getMinutes());
cal.set(Calendar.HOUR, objects.get(i).getDate("StartTime").getHours());
event.setStartTime(cal);
Calendar calEnd = Calendar.getInstance();
calEnd.set(Calendar.DAY_OF_WEEK, objects.get(i).getDate("EndTime").getDay());
calEnd.set(Calendar.DAY_OF_MONTH, objects.get(i).getDate("EndTime").getMonth());
calEnd.set(Calendar.DAY_OF_YEAR, objects.get(i).getDate("EndTime").getYear());
calEnd.set(Calendar.MINUTE, objects.get(i).getDate("EndTime").getMinutes());
calEnd.set(Calendar.HOUR, objects.get(i).getDate("EndTime").getHours());
event.setEndTime(calEnd);
event.setColor(getResources().getColor(R.color.event_color_01));
eventsWeb.add(event);
}
}
}
});
}
source
share