android-calendar

Calendar event intent - startActivityForResult

落花浮王杯 提交于 2019-11-29 11:26:08
I want to create an event into the calendar from my app. I can start a new event activity with: Intent intent = new Intent(Intent.ACTION_EDIT).setData(uri); intent.setType("vnd.android.cursor.item/event"); startActivityForResult(intent, REQUEST_ID); Is it possible to get the ID of the created event ? OnActivityResult resultCode is always 0 - whether I create the event or not. The data is always null. Is there some way to do it? 来源: https://stackoverflow.com/questions/11508511/calendar-event-intent-startactivityforresult

Make exception event from original recurring event?

好久不见. 提交于 2019-11-29 05:12:17
I found that Events.CONTENT_EXCEPTION_URI ( here ) used for make recurring event. It's hardly to find document or code example from internet. So I try many ways 1 Insert as SyncAdapter ContentValues values = new ContentValues(); values.put(Events.ORIGINAL_INSTANCE_TIME, CaldavGlobalVar.getCurrentTime_()); values.put(Events.SELF_ATTENDEE_STATUS, status); if(!username.equals("")){ values.put(Events.ORGANIZER, username); } if(event.getSummarry()!=null){ values.put(Events.TITLE, event.getSummarry()); } if(event.getDescription()!=null){ values.put(Events.DESCRIPTION, event.getDescription()); } if

Listen to android calendar changes. (Sync/Delete/Insert etc..)

与世无争的帅哥 提交于 2019-11-29 02:52:27
问题 I've understand I have to use Content Provider to get all changes, but I also realized starting API14 there is a ready Content Provider for the calendar which I can use to listen to instead of "building" my own custom one. Is there anywhere I can see an example of this ? Can someone please post the core of this listener ? Thanks 回答1: First you need to add this type of receiver to the Manifest: <receiver android:name="your.package.name.CatchChangesReceiver" android:priority="1000" > <intent

Reading all of today's events using CalendarContract - Android 4.0+

断了今生、忘了曾经 提交于 2019-11-29 01:52:34
I'm trying to use Android's new calendar API to read all of today's calendar events. I'm have trouble finding the right selection on the database query to return all of the events. It seems that all recurring and all day events are left out of the selection. What selection args would permit me to obtain all of today's events from the calendar api? Here is my current attempt: Cursor cur = null; String selection = "((" + CalendarContract.Events.DTSTART + " >= ?) AND (" + CalendarContract.Events.DTEND + " <= ?))"; Time t = new Time(); t.setToNow(); String dtStart = Long.toString(t.toMillis(false)

how to show milliseconds in days:hours:min:seconds

前提是你 提交于 2019-11-28 18:47:53
问题 This is what I have at the moment Seconds = (60 - timeInMilliSeconds / 1000 % 60); Minutes = (60 - ((timeInMilliSeconds / 1000) / 60) %60); which I feel is correct. for hours and days should it be like - Hours = ((((timeInMilliSeconds / 1000) / 60) / 60) % 24); Days = ((((timeInMilliSeconds / 1000) / 60) / 60) / 24) % 24; and then- TextView.SetText("Time left:" + Days + ":" + Hours + ":" + Minutes + ":" + Seconds); but my hours and days are coming out to be incorrect 回答1: A simple way to

Custom calendar dayview in android

自古美人都是妖i 提交于 2019-11-28 17:06:02
I want to develop a custom calendar day view for android OS 1.5 and later on. Similar to android day calendar and event add & display in day view. If you have example or source of it then please give me. I have no idea how to start. Please guide me. I have done month view as per below link: http://w2davids.wordpress.com/android-simple-calendar/ but I have to also create day view so please help me. I want to display this: Sherif elKhatib I just worked on this: You could consider it a blueprint to start. /** * @author Sherif * * Copyright 2011 * * Sample Day Viewer that will show entries of each

android: EXDATE format when adding a calendar event

泪湿孤枕 提交于 2019-11-28 12:23:41
Can someone explain how to use EXDATE when adding event to android calendar? The documentation is pretty unclear about the format in which the EXDATE should be put. I tried many formats, these are some of them: values.put(Events.EXDATE, "TZID=Europe/London:20130116T080000"); values.put(Events.EXDATE, "20130116T080000Z"); values.put(Events.EXDATE, "20130116T080000"); values.put(Events.EXDATE, "20130116"); but none of them works. Any idea how to make an event not appear on a particular date, if by the RRULE it should appear? The correct format is: values.put(Events.EXDATE, "20130116T080000Z");

Is there a way to access the calendar's entries without using gdata-java-client?

微笑、不失礼 提交于 2019-11-28 06:39:27
Is it possible to get the calendar's entries from the phone offline? It seem the only way is to use gdata-java-client . Shea Levy These answers are good, but they all involve hard-coding the Calendar URI (which I've seen in three different incarnations across different Android devices). A better way to get that URI (which hard-codes the name of a class and a field instead) would be something like this: Class<?> calendarProviderClass = Class.forName("android.provider.Calendar"); Field uriField = calendarProviderClass.getField("CONTENT_URI"); Uri calendarUri = (Uri) uriField.get(null); This isn

BroadcastReceiver for Android Calendar events

天大地大妈咪最大 提交于 2019-11-28 05:30:32
I am trying to write a BroadcastReceiver that listens to events like insert, edit, delete to the native android calendar (ICS and above). So whenever one of these events occur the app should be able to at the least know that these events occurred. Any one has an idea, how to do this or any reference links. I have written my own broadcasterReceiver class that extends from BroadcastReceiver. Can't figure out the values in the manifest like, currently I have this which is not working: <receiver android:name=".NativeEventChangeReceiver"> <intent-filter> <action android:name="android.intent.action

How to add calendar events to default calendar, silently without Intent, in android 4?

房东的猫 提交于 2019-11-28 04:23:22
I want to add calendar events programmatically (directly) in android 4+. Is it this possible to be tested on emulator? I don't own an android phone. Some sample code would be appreciated. I read Calendar Provider of android developers but I'm confused. How can I add events to the default calendar of a user? I don't need to be synced. EDIT: I do not want to launch an event adding Intent. Instead I want to add them completely from code and not launch another activity. I need to be able to test on an emulator that the events will be added to the main calendar of the default user of the device.