java - Android Calendar Intent event end always one hour after start, API level 8+ -
i understand same title used before, specific question (and answer) used contentvalues class, api level 14+; program uses minimum of api level 8. use intent putextra add values calendar:
calendar begintime = calendar.getinstance(); begintime.set(year, month, day, fromhour, frommin, 0); calendar endtime = calendar.getinstance(); endtime.set(year, month, day, tohour, tomin, 0); long startmillis = begintime.gettimeinmillis(); long endmillis = endtime.gettimeinmillis(); intent intent = new intent(intent.action_edit); intent.settype("vnd.android.cursor.item/event"); intent.putextra("begintime", startmillis); intent.putextra("allday", false); intent.putextra("endtime", endmillis); intent.putextra("title", strselected); intent.putextra("description", strselected+" "+mindiff+ " minutes burning "+calorieburned+" calories"); intent.putextra("eventlocation", "gym"); startactivity(intent);
where year, month, day, fromhour, frommin, etc variables defined in above code. calendar works of these values except end time, hour after start time no matter start time is. when compared startmillis endmillis, both correct (and therefore endmillis more 1 hour startmillis), correct end date being passed calendar calendar not seem adjust correctly.
if remove intent.putextra("endtime", endmillis); code completely, start date remains correct, end date reverts default (1970's). therefore calendar recognizing line of code, not using correct endmillis value, or stuck @ displaying hour after start date.
even if input end time less hour after start time, calendar still displays hour after start date.
any appreciated. thanks.
it seems bug in older android phones; got new android phone , works without changing code.
i don't think there solution question besides updating android os, since unavoidable bug.
Comments
Post a Comment