-
Notifications
You must be signed in to change notification settings - Fork 422
Open
Description
In my code, I have calenderFragment (where the main compactCalnder is) and a DayActivity. When a day in the calendar is clicked, the DayActivity is started. What I'm trying to do is, when 'submit' button in DayActivity is pressed an event with the day's date should be created and a dot under the day should appear. However, that doesn't happen. It works when I manually create an event using hardcoded dates and call the addEvent method on the calendar. Am I missing something? I'm relatively new to Android
calenderFragment.java:
compactCalendar.setListener(new CompactCalendarView.CompactCalendarViewListener() {
@Override
public void onDayClick(Date dateClicked) {
String fullDateStr = dateFormatForFullDate.format(dateClicked);
try {
Date fullDate = dateFormatForFullDate.parse(fullDateStr);
timeInMillis = fullDate.getTime();
} catch (ParseException e) {
e.printStackTrace();
}
Intent intent = new Intent(getActivity(),DayActivity.class);
intent.putExtra("dateInMills", timeInMillis); // here I'm just passing the days date in milliseconds to DayActivity
startActivity(intent);
}
<...>
DayActivity.java:
<...>
Intent intent = getIntent();
long dateInMills = intent.getLongExtra("dateInMills", 0);
dateTv.setText(date);
doneBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Event ev = new Event(Color.parseColor("#613DC1"), dateInMills, "Cried");
// compactCalendar.addEvent(ev);
// this part doesn't work
// Toast.makeText(getApplicationContext(), "date: " + dateInMills, Toast.LENGTH_SHORT).show();
// date passed is correct
}
Metadata
Metadata
Assignees
Labels
No labels