Calendar help for a newbie please?

malcfreem

Member
Licensed User
Longtime User
:sign0085: Hi everyone. I am new to B4A (version 2.52, registered) and I would love some help please with Calendars within an app I am trying to write, please..

1) First I need to check if a Calendar (lets call it 'Fixtures') exists.
If it exists, I need to delete all entries in it.
If it doesnt exist, I need to create it.
(either way I need to end up with an empty calendar called 'Fixtures')
2) Then I need to add entries and set a warning alarm for each.

I guess this stuff has been done many times before and so I though I'd ask for your help. I would like my app to work on any version of Androis OS, although I am creating the app from 4.2.2.

Would anyone please have the time to help me with code samples? Please remember I'm new to this.

Thanks in anticipation of any help given.

Malcolm F
 

malcfreem

Member
Licensed User
Longtime User
Thanks but

Thanks for taking the time to reply. Yes I had seen that and it's why I asked for code samples...

I don't understand what returning a Map is.
It doesnt show me how to create a new calendar
It doesnt show me how to clear a calendar
It MAY show me how to add events with a reminder

...but I really do need specific help please.

Cheers,

Malcolm F
 
Upvote 0

malcfreem

Member
Licensed User
Longtime User
Its moved on a bit...

OK, now I have found out how to download Calendar2 and where to put the .jar and .xml files so that it shows in my app.

I have managed to get a list of all existing calendars addnd have worked out how to check if my calendar (Fixtures in this example) exists or not.

So far so good...

Now I need to know how to delete the entire calendar if it exists
and then to Add a new calendar so that I can add events to it.

Can anyone please help?

Malc
 
Upvote 0

lagore

Active Member
Licensed User
Longtime User
Hi,
It is not possible to create or delete a calendar with the Calendar2 library as I never got around to adding that facility. There are a lot of complications in creating a new calendar. If you already have a calendar (Fixtures) can you not just delete all of the events in that calendar and then add the new events to that calendar. At the moment in my app I recommend that the user creates a new calendar online then that calendar will be available to the device, this is only practicable if you only need to create a new calendar now and then.
 
Upvote 0

malcfreem

Member
Licensed User
Longtime User
Thanks for that info...

Thanks Edward. That is a real blow.

What I want to do is distribute my app and populate the users calendar with a list of fixtures. When fixtures change, I want to delete all old entries from the calendar and insert the new (updated) ones. I thought the easiest way would be to create a unique calendar.

It seems that wont be possible, so can you please tell me this? Will a user always have one (default) calendar present or are there occasions when getlistofallcalendars return no calendars?

M
 
Upvote 0

lagore

Active Member
Licensed User
Longtime User
There should always be a default calendar. What I do is put a text tag in the title or description field then when I search for the events to be updated I also check if the tag is present before I delete the event, then create the new updated event. It works very well I use it for a work roster app. If you need any additional help let me know.

Sent from my Nexus 7 using Tapatalk 2
 
Upvote 0

malcfreem

Member
Licensed User
Longtime User
Your help

Thanks again Edward.

In that case what I think I will do i put my fixtures in the defalt calendar with a unique title relevant to my app. In this way I can search for and delete all 'old' entries, then add new ones. That should work OK I guess.

Thanks for your help.

Malcolm
 
Upvote 0
Top