Android Question How to launch the default calendar app?

NeoTechni

Well-Known Member
Licensed User
Longtime User
Here's the partial code in java I found from a site
B4X:
Intent calIntent = new Intent(Intent.ACTION_MAIN);
calIntent.addCategory(Intent.CATEGORY_APP_CALENDAR);

Which translates to:

B4X:
Sub OpenCalendarApp
    Dim I As Intent
    I.Initialize("android.intent.action.MAIN", "")
    I.AddCategory("android.intent.category.APP_CALENDAR")

End Sub

I tried startactivity(i) but it crashed, what comes next?
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
Upvote 0

NeoTechni

Well-Known Member
Licensed User
Longtime User
I tried adding:
B4X:
I.PutExtra("time", DateTime.Now)
And now the calendar app won't even start. It just says "event not found" on kitkat
 
Upvote 0

aeropic

Active Member
Licensed User
Longtime User
Hi,

I have the same issue with a Nexus5 kitkat and found this code :

B4X:
/**
* Edit a calendar event.
*/
private void editCalendarEvent(){
    Context context = getContext();
    long calendarEventID = .....
    intent.setData(Uri.parse("content://com.android.calendar/events/" + String.valueOf(calendarEventID)));
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
        | Intent.FLAG_ACTIVITY_SINGLE_TOP
        | Intent.FLAG_ACTIVITY_CLEAR_TOP
        | Intent.FLAG_ACTIVITY_NO_HISTORY
        | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
  context.startActivity(intent);
}

but frankly speaking I don't know how to translate it into B4A... lost with intent.Setdata, and Uri.parse...

Finally did you get the solution NeoTechni ?
 
Upvote 0

NeoTechni

Well-Known Member
Licensed User
Longtime User
Nope. I don't want to edit an even, or open an event. Just open the app. And the code above, wants to edit an event.
 
Upvote 0

NeoTechni

Well-Known Member
Licensed User
Longtime User
Here's the logs...

** Service (widgets) Start **


START u0 {act=android.intent.action.VIEW typ=vnd.android.cursor.item/event flg=0x10000000 cmp=com.google.android.calendar/com.android.calendar.EventInfoActivity (has extras)} from pid 6637


Cursor finalized without prior close()
select_devices: out_snd_device(2: speaker) in_snd_device(0: )
***************


allowedAvailability = 0,1
cal_sync9 = null
cal_sync8 = 1383******5759
ownerAccount = ******@gmail.com
cal_sync7 = null
visible = 1


cal_sync6 = null
canOrganizerRespond = 1
cal_sync5 = 0
cal_sync4 = 1
cal_sync3 = null
cal_sync2 = null
canModifyTimeZone = 1
cal_sync1 = ******@gmail.com
calendar_color_index = 17
_id = 1
calendar_timezone = America/Toronto
_sync_id = null
allowedReminders = 0,1,2
cal_sync10 = null
name = Techni Myoko
sync_events = 1
calendar_access_level = 700
dirty = null
allowedAttendeeTypes = 0,1,2
canPartiallyUpdate = 1
account_type = com.google
COALESCE(isPrimary, ownerAccount = account_name) = 1
maxReminders = 5
deleted = 0
calendar_color = -6644481
account_name = ******@gmail.com
calendar_location = null
calendar_displayName = Techni Myoko
mutators = null
Calendar ID = 1 Display Name = Techni Myoko Account Name = ******@gmail.com
***************
allowedAvailability = 0,1
cal_sync9 = null
cal_sync8 = 1383865185813
ownerAccount = ******@group.calendar.google.com
cal_sync7 = null
visible = 0
cal_sync6 = null
canOrganizerRespond = 1
cal_sync5 = 0
cal_sync4 = 0
cal_sync3 = null
cal_sync2 = null
canModifyTimeZone = 1
cal_sync1 = ******@group.calendar.google.com
calendar_color_index = 2
_id = 4
calendar_timezone = America/Toronto
_sync_id = null
allowedReminders = 0,1,2
cal_sync10 = null
name = Controller and Peripheral Museum
sync_events = 0
calendar_access_level = 700
dirty = null
allowedAttendeeTypes = 0,1,2
canPartiallyUpdate = 1
account_type = com.google
COALESCE(isPrimary, ownerAccount = account_name) = 0
maxReminders = 5
deleted = 0
calendar_color = -3118236
account_name = ******@gmail.com
calendar_location = null
calendar_displayName = Controller and Peripheral Museum
mutators = null
Calendar ID = 4 Display Name = Controller and Peripheral Museum Account Name = ******@gmail.com
***************
allowedAvailability = 0,1
cal_sync9 = null
cal_sync8 = null
ownerAccount = ******@gmail.com
cal_sync7 = null
visible = 1
cal_sync6 = null
canOrganizerRespond = 1
cal_sync5 = 0
cal_sync4 = 1
cal_sync3 = null
cal_sync2 = null
canModifyTimeZone = 1
cal_sync1 = ******@gmail.com
calendar_color_index = null
_id = 5
calendar_timezone = America/Toronto
_sync_id = null
allowedReminders = 0,1,2
cal_sync10 = null
name = null
sync_events = 1
calendar_access_level = 700
dirty = null
allowedAttendeeTypes = 0,1,2
canPartiallyUpdate = 0
account_type = com.google
COALESCE(isPrimary, ownerAccount = account_name) = 1
maxReminders = 5
deleted = 0
calendar_color = -14069085
account_name = ******@gmail.com
calendar_location = null
calendar_displayName = ******@gmail.com
mutators = null
Calendar ID = 5 Display Name = ******@gmail.com Account Name = ******@gmail.com
********************* START **************
[Ljava.lang.String;@42a6e758 ((calendar_id = ?) AND (begin >= ?) AND ((end <= ?) OR (dtend is null)) ) [Ljava.lang.String;@42a6e6d8
**START Calendar Event Description between dates**
Payday14020128000001402099200000
eventEndTimezone=null
isOrganizer=1
visible=1
rrule=FREQ=WEEKLY;INTERVAL=2;WKST=SU;BYDAY=FR
hasAlarm=0
calendar_color_index=17
rdate=null
dtstart=1255651200000
hasAttendeeData=1
calendar_timezone=America/Toronto
startDay=2456815
description=
calendar_access_level=700
customAppPackage=null
account_type=com.google
hasExtendedProperties=0
eventLocation=Work
dtend=null
allDay=1
organizer=******@gmail.com
deleted=0
account_name=******@gmail.com
originalInstanceTime=null
selfAttendeeStatus=0
eventColor_index=null
eventTimezone=UTC
allowedAvailability=0,1
ownerAccount=******@gmail.com
endDay=2456815
canOrganizerRespond=1
endMinute=1440
event_id=2
lastDate=null
canModifyTimeZone=1
guestsCanModify=0
exrule=null
guestsCanSeeGuests=1
title=Payday
_id=46
_sync_id=dl0js0cvivs0mfh7f0b7tveb20
displayColor=-6644481
uid2445=null
allowedReminders=0,1,2
allowedAttendeeTypes=0,1,2
end=1402099200000
availability=1
startMinute=0
calendar_id=1
original_id=null
originalAllDay=null


customAppUri=null
maxReminders=5
accessLevel=0
begin=1402012800000
calendar_color=-6644481
duration=P1D
calendar_displayName=Techni Myoko
original_sync_id=null
guestsCanInviteOthers=1
eventColor=null
exdate=null
eventStatus=1
**END Calendar Event Description between dates**
*********
**START Calendar Event Description between dates**
Payday14032224000001403308800000
eventEndTimezone=null
isOrganizer=1
visible=1
rrule=FREQ=WEEKLY;INTERVAL=2;WKST=SU;BYDAY=FR
hasAlarm=0
calendar_color_index=17
rdate=null
dtstart=1255651200000
hasAttendeeData=1
calendar_timezone=America/Toronto
startDay=2456829
description=
calendar_access_level=700
customAppPackage=null
account_type=com.google
hasExtendedProperties=0
eventLocation=Work
dtend=null
allDay=1
organizer=******@gmail.com
deleted=0
account_name=******@gmail.com
originalInstanceTime=null
selfAttendeeStatus=0
eventColor_index=null
eventTimezone=UTC
allowedAvailability=0,1
ownerAccount=******@gmail.com
endDay=2456829
canOrganizerRespond=1
endMinute=1440
event_id=2
lastDate=null
canModifyTimeZone=1
guestsCanModify=0
exrule=null
guestsCanSeeGuests=1
title=Payday
_id=49
_sync_id=dl0js0cvivs0mfh7f0b7tveb20
displayColor=-6644481
uid2445=null
allowedReminders=0,1,2
allowedAttendeeTypes=0,1,2
end=1403308800000
availability=1
startMinute=0
calendar_id=1
original_id=null
originalAllDay=null
customAppUri=null
maxReminders=5
accessLevel=0
begin=1403222400000
calendar_color=-6644481
duration=P1D
calendar_displayName=Techni Myoko
original_sync_id=null
guestsCanInviteOthers=1
eventColor=null
exdate=null
eventStatus=1
**END Calendar Event Description between dates**
*********
**START Calendar Event Description between dates**
Pay bills14035680000001403654400000
eventEndTimezone=null
isOrganizer=1
visible=1
rrule=FREQ=MONTHLY;WKST=MO
hasAlarm=0
calendar_color_index=17
rdate=null
dtstart=1303603200000
hasAttendeeData=1
calendar_timezone=America/Toronto
startDay=2456833
description=
calendar_access_level=700
customAppPackage=null
account_type=com.google
hasExtendedProperties=0
eventLocation=
dtend=null
allDay=1
organizer=******@gmail.com
deleted=0
account_name=******@gmail.com
originalInstanceTime=null
selfAttendeeStatus=0
eventColor_index=null
eventTimezone=UTC
allowedAvailability=0,1
ownerAccount=******@gmail.com
endDay=2456833
canOrganizerRespond=1
endMinute=1440
event_id=4
lastDate=null
canModifyTimeZone=1
guestsCanModify=0
exrule=null
guestsCanSeeGuests=1
title=Pay bills
_id=48
_sync_id=pe7pb0gsrfrj83casbqdg6fadc
displayColor=-6644481
uid2445=null
allowedReminders=0,1,2
allowedAttendeeTypes=0,1,2
end=1403654400000
availability=1
startMinute=0
calendar_id=1
original_id=null
originalAllDay=null
customAppUri=null
maxReminders=5
accessLevel=0
begin=1403568000000
calendar_color=-6644481
duration=P1D
calendar_displayName=Techni Myoko
original_sync_id=null
guestsCanInviteOthers=1
eventColor=null
exdate=null
eventStatus=1
**END Calendar Event Description between dates**
*********
**START Calendar Event Description between dates**
Google Payout14029632000001403049600000
eventEndTimezone=null
isOrganizer=1
visible=1
rrule=FREQ=MONTHLY;WKST=MO
hasAlarm=0
calendar_color_index=17
rdate=null
dtstart=1368748800000
hasAttendeeData=1
calendar_timezone=America/Toronto
startDay=2456826
description=
calendar_access_level=700
customAppPackage=null
account_type=com.google
hasExtendedProperties=0
eventLocation=
dtend=null
allDay=1
organizer=******@gmail.com
deleted=0
account_name=******@gmail.com
originalInstanceTime=null
selfAttendeeStatus=0
eventColor_index=null
eventTimezone=UTC
allowedAvailability=0,1
ownerAccount=******@gmail.com
endDay=2456826
canOrganizerRespond=1
endMinute=1440
event_id=51
lastDate=null
canModifyTimeZone=1


guestsCanModify=0
exrule=null
guestsCanSeeGuests=1
title=Google Payout
_id=47
_sync_id=o1m0kdg0jusjbep8nddb8c4nqc
displayColor=-6644481
uid2445=null
allowedReminders=0,1,2
allowedAttendeeTypes=0,1,2
end=1403049600000
availability=1
startMinute=0
calendar_id=1
original_id=null
originalAllDay=null
customAppUri=null
maxReminders=5
accessLevel=0
begin=1402963200000
calendar_color=-6644481
duration=P1D
calendar_displayName=Techni Myoko
original_sync_id=null
guestsCanInviteOthers=1
eventColor=null
exdate=null
eventStatus=1
**END Calendar Event Description between dates**
*********
**START Calendar Event Description between dates**
Work14020884000001402124400000
eventEndTimezone=null
isOrganizer=1
visible=1
rrule=null
hasAlarm=1
calendar_color_index=17
rdate=null
dtstart=1402088400000
hasAttendeeData=1
calendar_timezone=America/Toronto
startDay=2456815
description=
calendar_access_level=700
customAppPackage=null
account_type=com.google
hasExtendedProperties=0
eventLocation=
dtend=1402124400000
allDay=0
organizer=******@gmail.com
deleted=0
account_name=******@gmail.com
originalInstanceTime=null
selfAttendeeStatus=0
eventColor_index=null
eventTimezone=America/Toronto
allowedAvailability=0,1
ownerAccount=******@gmail.com
endDay=2456816
canOrganizerRespond=1
endMinute=180
event_id=280
lastDate=1402124400000
canModifyTimeZone=1
guestsCanModify=0
exrule=null
guestsCanSeeGuests=1
title=Work
_id=64
_sync_id=q5gf29s100h5etbiktlkr8d5ok
displayColor=-6644481
uid2445=null
allowedReminders=0,1,2
allowedAttendeeTypes=0,1,2
end=1402124400000
availability=0
startMinute=1020
calendar_id=1
original_id=null
originalAllDay=null
customAppUri=null
maxReminders=5
accessLevel=0
begin=1402088400000
calendar_color=-6644481
duration=null
calendar_displayName=Techni Myoko
original_sync_id=null
guestsCanInviteOthers=1
eventColor=null
exdate=null
eventStatus=1
**END Calendar Event Description between dates**
*********
**START Calendar Event Description between dates**
Work14021748000001402210800000
eventEndTimezone=null
isOrganizer=1
visible=1
rrule=null
hasAlarm=1
calendar_color_index=17
Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@436dffd8 attribute=null, token = android.os.BinderProxy@433e6d70
rdate=null
dtstart=1402174800000
hasAttendeeData=1
calendar_timezone=America/Toronto
startDay=2456816
description=
calendar_access_level=700
customAppPackage=null
account_type=com.google
hasExtendedProperties=0
eventLocation=
dtend=1402210800000
allDay=0
organizer=******@gmail.com
deleted=0
account_name=******@gmail.com
originalInstanceTime=null
selfAttendeeStatus=0
eventColor_index=null
eventTimezone=America/Toronto
allowedAvailability=0,1
ownerAccount=******@gmail.com
endDay=2456817
canOrganizerRespond=1
endMinute=180
event_id=281
lastDate=1402210800000
canModifyTimeZone=1
guestsCanModify=0
exrule=null
guestsCanSeeGuests=1
title=Work
_id=65
_sync_id=uakun703d22arnvak9dh6bcn04
displayColor=-6644481
uid2445=null
allowedReminders=0,1,2
allowedAttendeeTypes=0,1,2
end=1402210800000
availability=0
startMinute=1020
calendar_id=1
original_id=null
originalAllDay=null
customAppUri=null
maxReminders=5
accessLevel=0
begin=1402174800000
calendar_color=-6644481
duration=null
calendar_displayName=Techni Myoko
original_sync_id=null
guestsCanInviteOthers=1
eventColor=null
exdate=null
eventStatus=1
**END Calendar Event Description between dates**
*********
**START Calendar Event Description between dates**
Work14022612000001402293600000
eventEndTimezone=null
isOrganizer=1
visible=1
rrule=null
hasAlarm=1
calendar_color_index=17
rdate=null
dtstart=1402261200000
hasAttendeeData=1
calendar_timezone=America/Toronto
startDay=2456817
description=
calendar_access_level=700
customAppPackage=null
account_type=com.google
hasExtendedProperties=0
eventLocation=
dtend=1402293600000


allDay=0
organizer=******@gmail.com
deleted=0
account_name=******@gmail.com
originalInstanceTime=null
selfAttendeeStatus=0
eventColor_index=null
eventTimezone=America/Toronto
allowedAvailability=0,1
ownerAccount=******@gmail.com
endDay=2456818
canOrganizerRespond=1
endMinute=120
event_id=282
lastDate=1402293600000
canModifyTimeZone=1
guestsCanModify=0
exrule=null
guestsCanSeeGuests=1
title=Work
_id=66
_sync_id=ctnagqktdqi0jifbk1kl8sfs4o
displayColor=-6644481
uid2445=null
allowedReminders=0,1,2
allowedAttendeeTypes=0,1,2
end=1402293600000
availability=0
startMinute=1020
calendar_id=1
original_id=null
originalAllDay=null
customAppUri=null
maxReminders=5
accessLevel=0
begin=1402261200000
calendar_color=-6644481
duration=null
calendar_displayName=Techni Myoko
original_sync_id=null
guestsCanInviteOthers=1
eventColor=null
exdate=null
eventStatus=1
**END Calendar Event Description between dates**
*********
**START Calendar Event Description between dates**
See apartment14023368000001402340400000
eventEndTimezone=null
isOrganizer=1
visible=1
rrule=null
hasAlarm=1
calendar_color_index=17
rdate=null
dtstart=1402336800000
hasAttendeeData=1
calendar_timezone=America/Toronto
startDay=2456818
description=
calendar_access_level=700
customAppPackage=null
account_type=com.google
hasExtendedProperties=0
eventLocation=
dtend=1402340400000
allDay=0
organizer=******@gmail.com
deleted=0
account_name=******@gmail.com
originalInstanceTime=null
selfAttendeeStatus=0
eventColor_index=
eventTimezone=America/Toronto
allowedAvailability=0,1
ownerAccount=******@gmail.com
endDay=2456818
canOrganizerRespond=1
endMinute=900
event_id=279
lastDate=1402340400000
canModifyTimeZone=1
guestsCanModify=0
exrule=null
guestsCanSeeGuests=1
title=See apartment
_id=71
_sync_id=b7sffsns9eonm5lkjk10md7d2g
displayColor=-6644481
uid2445=null
allowedReminders=0,1,2
allowedAttendeeTypes=0,1,2
end=1402340400000
availability=0
startMinute=840
calendar_id=1
original_id=null
originalAllDay=null
customAppUri=null
maxReminders=5
accessLevel=0
begin=1402336800000
calendar_color=-6644481
duration=null
calendar_displayName=Techni Myoko
original_sync_id=null
guestsCanInviteOthers=1
eventColor=null
exdate=null
eventStatus=1
**END Calendar Event Description between dates**
*********
**START Calendar Event Description between dates**
Work14023440000001402358400000
eventEndTimezone=null
isOrganizer=1
visible=1
rrule=null
hasAlarm=1
calendar_color_index=17
rdate=null
dtstart=1402344000000
hasAttendeeData=1
calendar_timezone=America/Toronto
startDay=2456818
description=
calendar_access_level=700
customAppPackage=null
account_type=com.google
hasExtendedProperties=0
eventLocation=
dtend=1402358400000
allDay=0
organizer=******@gmail.com
deleted=0
account_name=******@gmail.com
originalInstanceTime=null
selfAttendeeStatus=0
eventColor_index=null
eventTimezone=America/Toronto
allowedAvailability=0,1
ownerAccount=******@gmail.com
endDay=2456818
canOrganizerRespond=1
endMinute=1200
event_id=283
lastDate=1402358400000
canModifyTimeZone=1
guestsCanModify=0
exrule=null
guestsCanSeeGuests=1
title=Work
_id=67
_sync_id=0be2hr637guveth3nkhh4a945o
displayColor=-6644481
uid2445=null
allowedReminders=0,1,2
allowedAttendeeTypes=0,1,2
end=1402358400000
availability=0
startMinute=960
calendar_id=1
original_id=null
originalAllDay=null
customAppUri=null
maxReminders=5
accessLevel=0
begin=1402344000000
calendar_color=-6644481
duration=null
calendar_displayName=Techni Myoko
original_sync_id=null
guestsCanInviteOthers=1
eventColor=null
exdate=null
eventStatus=1
**END Calendar Event Description between dates**
*********
**START Calendar Event Description between dates**
Work14026932000001402729200000
eventEndTimezone=null
isOrganizer=1
visible=1
rrule=null
hasAlarm=1
calendar_color_index=17
rdate=null
dtstart=1402693200000
hasAttendeeData=1


calendar_timezone=America/Toronto
startDay=2456822
description=
calendar_access_level=700
customAppPackage=null
account_type=com.google
hasExtendedProperties=0
eventLocation=
dtend=1402729200000
allDay=0
organizer=******@gmail.com
deleted=0
account_name=******@gmail.com
originalInstanceTime=null
selfAttendeeStatus=0
eventColor_index=null
eventTimezone=America/Toronto
allowedAvailability=0,1
ownerAccount=******@gmail.com
endDay=2456823
canOrganizerRespond=1
endMinute=180
event_id=284
lastDate=1402729200000
canModifyTimeZone=1
guestsCanModify=0
exrule=null
guestsCanSeeGuests=1
title=Work
_id=68
_sync_id=sien1dugn99dnon870c6mc7nq4
displayColor=-6644481
uid2445=null
allowedReminders=0,1,2
allowedAttendeeTypes=0,1,2
end=1402729200000
availability=0
startMinute=1020
calendar_id=1
original_id=null
originalAllDay=null
customAppUri=null
maxReminders=5
accessLevel=0
begin=1402693200000
calendar_color=-6644481
duration=null
calendar_displayName=Techni Myoko
original_sync_id=null
guestsCanInviteOthers=1
eventColor=null
exdate=null
eventStatus=1
**END Calendar Event Description between dates**
*********
**START Calendar Event Description between dates**
Work14027796000001402815600000
eventEndTimezone=null
isOrganizer=1
visible=1
rrule=null
hasAlarm=1
calendar_color_index=17
rdate=null
dtstart=1402779600000
hasAttendeeData=1
calendar_timezone=America/Toronto
startDay=2456823
description=
calendar_access_level=700
customAppPackage=null
account_type=com.google
hasExtendedProperties=0
eventLocation=
dtend=1402815600000
allDay=0
organizer=******@gmail.com
deleted=0
account_name=******@gmail.com
originalInstanceTime=null
selfAttendeeStatus=0
eventColor_index=null
eventTimezone=America/Toronto
allowedAvailability=0,1
ownerAccount=******@gmail.com
endDay=2456824
canOrganizerRespond=1
endMinute=180
event_id=285
lastDate=1402815600000
canModifyTimeZone=1
guestsCanModify=0
exrule=null
guestsCanSeeGuests=1
title=Work
_id=69
_sync_id=gh7ok3q7u62fsom24n1rn88k3k
displayColor=-6644481
uid2445=null
allowedReminders=0,1,2
allowedAttendeeTypes=0,1,2
end=1402815600000
availability=0
startMinute=1020
calendar_id=1
original_id=null
originalAllDay=null
customAppUri=null
maxReminders=5
accessLevel=0
begin=1402779600000
calendar_color=-6644481
duration=null
calendar_displayName=Techni Myoko
original_sync_id=null
guestsCanInviteOthers=1
eventColor=null
exdate=null
eventStatus=1
**END Calendar Event Description between dates**
*********
**START Calendar Event Description between dates**
Work14028660000001402898400000
eventEndTimezone=null
isOrganizer=1
visible=1
rrule=null
hasAlarm=1
calendar_color_index=17
rdate=null
dtstart=1402866000000
hasAttendeeData=1
calendar_timezone=America/Toronto
startDay=2456824
description=
calendar_access_level=700
customAppPackage=null
account_type=com.google
hasExtendedProperties=0
eventLocation=
dtend=1402898400000
allDay=0
organizer=******@gmail.com
deleted=0
account_name=******@gmail.com
originalInstanceTime=null
selfAttendeeStatus=0
eventColor_index=null
eventTimezone=America/Toronto
allowedAvailability=0,1
ownerAccount=******@gmail.com
endDay=2456825
canOrganizerRespond=1
endMinute=120
event_id=286
lastDate=1402898400000
canModifyTimeZone=1
guestsCanModify=0
exrule=null
guestsCanSeeGuests=1
title=Work
_id=70
_sync_id=nflg75pc55r37r3t51e2tlnlo4
displayColor=-6644481
uid2445=null
allowedReminders=0,1,2
allowedAttendeeTypes=0,1,2
end=1402898400000
availability=0
startMinute=1020
calendar_id=1
original_id=null
originalAllDay=null
customAppUri=null
maxReminders=5
accessLevel=0
begin=1402866000000
calendar_color=-6644481
duration=null
calendar_displayName=Techni Myoko
original_sync_id=null
guestsCanInviteOthers=1
eventColor=null
exdate=null
eventStatus=1
**END Calendar Event Description between dates**
*********
*********** FINISH **************


GC_CONCURRENT freed 367K, 3% free 17345K/17744K, paused 2ms+17ms, total 28ms
********************* START **************
[Ljava.lang.String;@42b0c130 ((calendar_id = ?) AND (begin >= ?) AND ((end <= ?) OR (dtend is null)) ) [Ljava.lang.String;@42b0c160
************ Error getting events ***************
********************* START **************
[Ljava.lang.String;@42a2f128 ((calendar_id = ?) AND (begin >= ?) AND ((end <= ?) OR (dtend is null)) ) [Ljava.lang.String;@42a2f158
************ Error getting events ***************
MDnsSdListener::Monitor poll timed out
Going to poll with pollCount 1
Writing exception to parcel
java.lang.IllegalArgumentException: Unknown URL content://com.android.calendar/events/-1
at com.android.providers.calendar.CalendarProvider2.queryInternal(CalendarProvider2.java:1029)
at com.android.providers.calendar.CalendarProvider2.query(CalendarProvider2.java:839)
at android.content.ContentProvider.query(ContentProvider.java:857)
at android.content.ContentProvider$Transport.query(ContentProvider.java:200)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
java.lang.IllegalArgumentException: Unknown URL content://com.android.calendar/events/-1
Unable to decode stream: java.io.FileNotFoundException: /: open failed: EISDIR (Is a directory)
resolveUri failed on bad bitmap uri:
 
Upvote 0

Mark Zraik

Member
Licensed User
Longtime User
It works but the calendar app crashes immediately
B4X:
Try
Dim i As Intent
  i.Initialize("android.intent.action.VIEW", "content://com.android.calendar/time/" &DateTime.Now)
   i.AddCategory("android.intent.category.DEFAULT")'add cat launcher
   i.PutExtra("id", phid)
StartActivity(i)'start the activity
Catch
Log("Error Caught: " & LastException)
End Try

Adding the SetComponent worked for me so far in opening the calendar to a monthly view. Android 2.3.5
I trolled through the logs after i decided to use the OS's calendar shortcut, found the Intents it used, and played around until it gave me the Calendar.
Leaving the URI blank forces Android to match up the best program/app to handle the intent, or if there are more than 1, give you the chooser.

Hope this helps,

NOTE: Don't forget the permissions in the manifest
AddPermission(android.permission.READ_CALENDAR)
AddPermission(android.permission.WRITE_CALENDAR)
Depending on what you intend to do of-course.

I came back and added the Try...Catch and modified this some more after testing between my Phone and a Tablet. The phone has 2.3.5, then tablet has 4.0.3, but it's a custom rom. The Calendar opened up on both devices and another phone running KitKat.
 
Last edited:
Upvote 0
Top