I am packing an intent and one of the Extras I add is a date object, like this:
intent.putExtra(DATE_EXTRA, t.getDate());
Later, when I reading the extras, I try to get the Date like this:
this.date = new Date(intent.getExtras().getString(DATE_EXTRA));
However, this returns an error about the String being empty. I don't think the above is the right way to do it, because I am not looking for a string, but I have not been able to find an intent.getDateExtra() method anywhere. What do I do?
I know that the date was passed properly, because I can see it while debugging:

Replace:
this.date = new Date(intent.getExtras().getString(DATE_EXTRA));
with:
this.date = (Date)intent.getSerializableExtra(DATE_EXTRA);
and see if that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With