Calia Kim
Calia Kim

Reputation: 63

Android putExtra mystery

enter image description here

The question above is in image I've just uploaded because Stackoverflow's

editor keeps complaining it was not properly formatted.

Upvotes: 1

Views: 82

Answers (5)

Jaydeep
Jaydeep

Reputation: 110

Change your code

i.putExtra("year",day);

to

i.putExtra("day",day);

Upvotes: 1

Blackbelt
Blackbelt

Reputation: 157457

you used the same key (year) to store day and year in your CalendarView . That's why, when you look for the key day it returns null (default value)

Upvotes: 3

OrhanC1
OrhanC1

Reputation: 1410

Change

i.putExtra("year", year);
i.putExtra("month", month);
i.putExtra("year", day);

to

i.putExtra("year", year);
i.putExtra("month", month);
i.putExtra("day", day);

Notice how the last putExtra's 1st parameter is different.

Upvotes: 1

Ravi
Ravi

Reputation: 35569

check you putextra() you are using "year" key for year and day

Upvotes: 1

Farouk Touzi
Farouk Touzi

Reputation: 3456

You problem is in CalendarView, you should write

i.putExtra("day",day);

instead of

i.putExtra("year",day);

Upvotes: 2

Related Questions