I intend to create an Android Application which manages Calendar Events. Unfortunately, I don't see a way in which I can present the user a way to add events for a given category, that the user might create.
Link to CalendarContracts.Events in official Android Documentation
The CalendarProcider.Events table doesn't seem to have any field, where I can store the category the event belongs to. Should I create a new calendar, linked to the same account, for each new category that I'd like to create? Is that the only way, if not the recommended one?
http://android.calengoo.com/pagedoc/pageinstallation/pageeventcolors/pageeventcolors.html
This link here argues that, perhaps different calendars should be created to represent the different categories.
Calendars in Google Calendar are like categories for your events. Just create additional calendars to categorize your events. E.g. you could create calendars named "Work", "Home", "Family", "Sports", "TV" and so on. By saving an event into a calendar the event will be displayed with the color of the calendar. An additional advantage when assigning colors to your events this way is that you can easily hide certain calendars/categories with a single tap by using the calendar selection bar.
I feel the reasoning is perfectly sane, and would provide the same functionality, unless there is another legit way to create categories within the same calendar.
Related
I can successfully retrieve documents from firestore, the trouble is, i do not know how to put them back where they came from!!
My app is a court booking system, it uses 7 fragments that represent the days of the week. Each fragment contains buttons that represent booking slots throughout the day. When a button is pressed, the court booking activity fires showing textviews and spinners.
The information I save to firestore includes a unique number representing a datestamp and a booking id that represents the id of the button that was pressed.... from here, I am lost, i need to write the retrieved database info back to their relevant places but i dont have anything unique in the way of widgets. The buttons are unique but all they do is fire a non unique court booking activity... any help appreciated... sorry for length, quite possibly more to add when answering questions.
To write to a document in Firestore you need to know the complete path to that document. You'll need to track the necessary IDs in your code, in a way that you can synchronize it with your UI elements.
A simple first pass could be to add a non-editable view (e.g. a label) to your UI for each document, and set the document ID (or entire path) in there. Then when the user clicks a button, you find the corresponding view with the ID, and from that can recreate the DocumentReference that you need to update.
I'm trying to delete future instances of a google calendar recurring (repeated) event pro-grammatically using content resolver.
And to do this i have updated the rRule of the event , so for example if want to delete future instances of an event starting from date 11/11/2016
i edit the rRule string to look like so:
FREQ=DAILY;UNTIL=20161111;WKST=SU
However , when viewing google calendar application i find no changes and i find the event color only has changed to black color.
Some notes to keep in mind:
1- I'm using a third party library to so :
https://github.com/EverythingMe/easy-content-providers
CalendarProvider calendarProvider = new CalendarProvider(context);
Event event = calendarProvider.getEvent(eventId);
event.rRule = "FREQ=DAILY;UNTIL=20161111;WKST=SU";
calendarProvider.update(event);
and all functionalities in this library seem to work fine.
2- While reading pro-grammatically recurring events that have a specific UNTIL date in it's rRule , i have realized that also a field in the google event called "lastDate" is updated with one hour later after the UNTIL value ,so do i have to update also this field while updating the UNTIL value in the rRule?
The problem was with the library ,
calendarProvider.update(event);
does not seems to work with all event fields!
I need to set multiple notifications at the same time based on a list of mutiple choice questions. I will figure the radio buttons and if statements out later, for now I'm just setting the dates randomly for testing purposes.
If the user selects jan 1st and clicks a button. It will set a notification in the future with a reminder to do an activity. It also saves this information so the user can edit the details if he desires or change a few options.
This part I already have coded and it works just fine. however, It only sets a single notification currently. It is a pretty involved code consisting database, receivers, fragments, etc. that all talk to each other.
As I said, this part I have working just fine but I am not including all the code because it is seriously involved and no one would try to break it down if i drown you in a sea of code. I can certainly post specific code if someone request it.
My issue is that I need it to set a good amount of notifications at various future dates upon the button click, not just one. I need to change the notification message to a preset variable string for each additional notification event but some things like title will remain the same.
my current working code executes like this....
User Selects Jan 1 > User Clicks Button > Notification set for Feb 14 with a unique title and message set by the user and saved for future editing...
At the same time the notifications are set they are saved so the user can change the date and a few options if needed. I want only one title and a single date saved. I have the save feature already working but I need to know how to link the additional reminders to the existing saved item. Im trying to make all the data linked so that if the user deletes the saved item, all the set notifications for that file are deleted and not just the one that falls on the user selected date.
===== This is what I am trying to pull off
User Picks Some Options and Clicks A Button [I have this working already]
Upon Click of said button, the following notifications are all set in the future :
[currently it sets this notification only]
Jan 1 notification :
(title)Day Master App
(message)Happy New Year
[Im trying to figure out how to add the following notifications upon the above button click and also save this information to the existing db under the same item]
Feb 14 notification : (title)Day Master App - (message)Its V Day
March 1 notification : (title)Day Master App - (message)Spring Is Near
March 14 notification : (title)Day Master App - (message)Its probably raining
(((and we'll just pretend i finished the list...)))
I cant make the future notifications a static number because when the future notifications are set is determined by a bunch of radio button choices before the user clicks the execute button. This is going to be a pretty complex and hacky if/else novel the way I think I have to do it. Am I correct?
I have a display/edit listview that shows your saved notifications and the unique name and date the user set. This works fine currently but only sets a single notification based on user input.
I need to add some more notifications but i dont need to save them under a different item or name. I want them all under the same save item so all the notifications that were set when the button was clicked can be added and deleted as a group. There will be no option to delete certain notifications that were set. It will be all or none.
I would imagine I could just add some more variables into the existing "save notification" code? As in piggyback some more items (like all the dates and messages) for the additional notifications? do i need to write a new function for each future notification I set in order to be able to delete it?
do I need to create a new db for each additional notification that is set? A separate Adapter? Im so confused...
===
Im not looking for a code example exactly, I want to know how this would be implemented into an existing code. I realize there is probably 100 ways to code what I have described. I just need the process explained.
Please explain this to me slowly. I know im way overthinking this.
I tried to explain this as best I could, if you need clarification on something please ask. Thank You.
I have solved my problem although I could not accomplish exactly what I was trying to originally.
I managed to set the multiple notifications on a single click with different dates by simply copying the same code I used to display the single notification and simply giving each additional notification a unique ID and creating a new variables to give them individual text, future dates, separate times, etc. These variables can be easily set programmaticly or by the user when you set them up.
// On clicking the set notifications button
public void SetNotificationsButton(View v){
ReminderDatabase rb = new ReminderDatabase(this);
// Creating Original Reminder
int ID = rb.addReminder(new Reminder(mTitle,
mDate, mTime, mRepeat, mRepeatNo, mRepeatType, mActive));
// Create Feeding Notification
int FeedingID = rb.addReminder(new Reminder("Have you fed the cat today?",
mFeedingDate, mFeedingTime, mRepeat, mRepeatNo, mRepeatType, mActive));
}
//
// and just continued copy and pasting the rest of the notification events
// changing the ID for each individual notification. Without a unique ID
// the current notification will override the previous notification and
// appear to only set the last reminder.
I was not able to remove all notifications by selecting a single list item, I probably could have figured this out by grouping the notifications into a separate variable but once I realized that you can only have a maximum of 50 notifications set at any given time it seemed like overkill.
Since I have a repeat option for certain notifications I can keep my notifications set; numbers low and stay away from the 50 at a time limit while still firing a reminder to the user every day.
I found a great example for setting single notifications I used as reference.
https://github.com/blanyal/Remindly
Thank those of you who took the time to read my question.
i developed an app-feature to create and sync a local phone calendar through an app. Now i have to sync this calendar online, best through the native phone account.
I tried to extend the URI's content values parameter (see API LVL < 8 parameter list below) by the account name and type but running after that into calendar freezes.
_id
sync_account
_sync_account_type
_sync_id
_sync_version
_sync_time
_sync_local_id
_sync_dirty
_sync_mark
url
name
displayName
hidden
color
access_level
selected
sync_events
location
timezone
ownerAccount
Is there another way to create an online syncable google calendar?
You cannot create a new one programatically.
Instead parse all available ones with
Uri.parse("content://com.android.calendar/calendars",null, null, null, null);
and fill in your events into a existing one.
But ensure, that your event got the same
sync_account
and
_sync_account_type
I'm working on application and I need some suggestions which is the best way to code it for Android. Basically it's something like event guide for a few cities. Imagine this :
I have an activity with 7 different buttons (7 different cities) and clicking on one of these buttons I'm opening a new activity where I have all months (January-December) as buttons again. If there is some event in February for example in the chosen city the button will be active and I will go to another activity where I have a list with the events. So my idea is to do it in this way :
Create one Activity with all Cities
Create one Calendar activity with all months.
When user select for example Paris, I'll send an extra via intent with an ID of the chosen city :
intent.putExtra("chosenCity", 2); //something like this
In the Calendar activity I will make active/inactive months buttons depending on that extra sent from Cities activity.
And when user chose a month I will send that chosenCity extra again to the ListViewEvents activity and populate the list view from Database (for example) depending on that extra.
So my question is : is it a good way to build an application like that? Or if it's not, which is the best way to achieve this?
Thanks in advance!
Sounds like you already know pretty much what you need to do. The only thing left is to implement it. The only thing I'll add is that your should probably store all your database and use a CursorAdapter to display them in the ListView. You can store all the events in the database and just create your select statement in such a way that it only selects the events you want to display at any given time. When using this CursorAdapter, I highly recommend you use the CursorLoader.