android-calendar

Android Calendar: onActivityResult's resultCode is always 0

旧城冷巷雨未停 提交于 2019-12-05 06:11:07
I develop an Android application that prompt the calendar application to edit events. I use startActivityForResult() to open the Calender. After editing and saving the event, resultCode is always 0 inside onActivityResult() . I saw many answers related to "onActivityResult resultCode always returns 0". This is because of not using the setResult() and finish() in the 2nd activity. But in my case, I am calling the Android calendar application (not a custom activity). The code to prompt the Android calendar: Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item

delete events from Calendar Provider on Android

徘徊边缘 提交于 2019-12-04 17:17:30
I have an application which uses the Calendar Provider for adding, editing and removing events. I have an interface of a calendar, which shows which days have events attached. Adding events works Perfectly. For adding an event I hardcoded the calendarID with the number 3, so calID = 3. long calID=3; values.put(Events.DESCRIPTION, description); values.put(Events.CALENDAR_ID, calID); values.put(Events.EVENT_TIMEZONE, "Europe/London"); Uri uri = cr.insert(Events.CONTENT_URI, values); This works perfectly. the View i've programmed shows the events. I open the Calendar application which comes

add calendar event without opening calendar

流过昼夜 提交于 2019-12-04 17:04:27
In my app, the user can set up to 3 reminders for a task, but every time I press the "set reminder" button it opens up the calendar app. Is there any way to set the calendar events without opening the default calendar app? I just want to add an event without starting the calendar activity. This is what my code looks like now: Calendar beginTime = Calendar.getInstance(); beginTime.set(2013, Calendar.MAY, 10, 3, 00); startMillis = beginTime.getTimeInMillis(); Calendar endTime = Calendar.getInstance(); endTime.set(2012, Calendar.MAY, 10, 4, 00); endMillis = endTime.getTimeInMillis(); Intent

Why does the datepicker add a calendar in my view?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 15:29:50
问题 I am starting to learn how to develop on Android. It is pretty straightforward but I'm facing an issue I did not find any mention anywhere... I have a view : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="16dp" android:paddingRight="16dp" android:orientation="vertical"> <EditText android:id="@+id/editNomProduit" android:layout_width="fill

Gregorian to Hijri (Islamic) date

流过昼夜 提交于 2019-12-04 14:19:59
Is there any way or library in Android to convert Gregorian date to Hijri(Islamic) one? I found some Java libraries such as Joda Time but I need something which works in Android. I found this but I didn't test it yet public class DateHijri { static double gmod(double n, double m) { return ((n % m) + m) % m; } static double[] kuwaiticalendar(boolean adjust) { Calendar today = Calendar.getInstance(); int adj = 0; if (adjust) { adj = 0; } else { adj = 1; } if (adjust) { int adjustmili = 1000 * 60 * 60 * 24 * adj; long todaymili = today.getTimeInMillis() + adjustmili; today.setTimeInMillis

add android calendar events using java

让人想犯罪 __ 提交于 2019-12-04 13:47:09
Hi I am trying to add event to android calendar. I am new to android development. Please help me how can I add events to android calendar. Here is my code which does not work. When I run it, it gives me a message "The application calendar (process com.something.something) has stopped unexpectedly"and has this button "Force to stop". Here is my code package com.zafar.calendar; import android.app.Activity; import android.content.ContentValues; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; public class Calendar extends Activity { /** Called when the activity is

Create calendar event from my app without default reminders

人盡茶涼 提交于 2019-12-04 07:41:46
I am developing an app that creates, updates and deletes events in native Google's calendar. I am creating an event by following code: ContentValues cvEvent = new ContentValues(); cvEvent.put(Events.DTSTART, startMillis); cvEvent.put(Events.DTEND, endMillis); cvEvent.put(Events.TITLE, strJobName); cvEvent.put(Events.CALENDAR_ID, mlCalendarID); cvEvent.put(Events.EVENT_TIMEZONE, "America/Los_Angeles"); Uri uriEvent = crEvent.insert(Events.CONTENT_URI, cvEvent); But the problem is that this event creates a default reminder as set by the user within his calendar (Google). I am also allowing users

How to read reminders in google calendars

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 04:27:43
I'm trying to read the reminders set by the user. What I mean with "reminder": currently there are two different meaning, the first one is the "alert" related to each event in the calendar and you can read them from CalendarContract.Reminders , the second one are unrelated events inserted by the user via Google Now with "remember me to...." or via Google Calendar app with insert reminder action. I'm talking about the second one. I'm reading from the event table CalendarContract.Events . However it seems that this information is not saved there or it's not accessible. Is there a different

PhoneGap/Cordova calendar integration (Android)

风流意气都作罢 提交于 2019-12-03 17:28:36
I'm building an Android app using PhoneGap (aka Cordova), and am having trouble getting a calendar integration to work. Disclaimer: I'm a noob to both Android and PhoneGap, please bear with me. All I'm trying to do is add an event to the user's calendar. Following this tutorial , I've created a Plugin that attempts to launch a Calendar Intent. The code looks like this: public class CalendarPlugin extends Plugin { public static final String NATIVE_ACTION_STRING="addToCalendar"; public static final String SUCCESS_PARAMETER="success"; @Override public PluginResult execute(String action, JSONArray

How to read google calendar events in android?

安稳与你 提交于 2019-12-03 16:21:31
问题 I am reading all the android calendar events and it is working fine by using this below code but, I want to fetch all the google calendar events from user mail accounts .How can I do that? Any suggestions or sample program will be really helpfull! For example: I want to get the events for xxxxxxxxx@gmail.com (the mail account which I opened in android mobile) public static void readCalendarEvent(Context context) throws ParseException { ContentResolver contentResolver = context