android-calendar

Split date/time strings

限于喜欢 提交于 2019-12-14 04:16:59
问题 I have a ReST service which downloads information about events in a persons calendar... When it returns the date and time, it returns them as a string e.g. date = "12/8/2012" & time = "11:25 am" To put this into the android calendar, I need to do the following: Calendar beginTime = Calendar.getInstance(); beginTime.set(year, month, day, hour, min); startMillis = beginTime.getTimeInMillis(); intent.put(Events.DTSTART, startMillis); How can I split the date and time variables so that they are

How can we add reminder to the calendar

旧街凉风 提交于 2019-12-13 19:37:50
问题 I am trying to add the event for start date to end date,I have done lots of googleing, but i m facing error,i have add permissions also in my mainfest file.the problem is in my code in executing the URI ...i have written lots of comment line..by that i hav tried to pass Uri,but still i am getting error.i.e read exception and in inserting the query..please help me. Thanks in advance package com.example.salesworld; import java.util.Calendar; import java.util.TimeZone; import android.app

Android Calendar View, show only 2 weeks

本小妞迷上赌 提交于 2019-12-13 15:27:14
问题 Is there a way to display a calendarview for 2 weeks at a time instead of the full month(4 weeks)? Please see the attached images. I would still like to retain the gestures Scrolling left/right will change months Scrolling up/down will show me the following weeks. Hoping that someone can point me in the right direction. Thank you! 回答1: for this what I did was the following Create View pager (to mimic swiping left and right of a calendar) In the view pager adapter, use fragments (MonthFragment

Discrepancy in Java Calendar set Day Of Month vs Get Day Of Month

允我心安 提交于 2019-12-13 09:24:22
问题 I am setting a Calendar day of month with an int value but when I check the value again the day of month from the created calendar it is 1 more than I set it to. And I am not sure why? Here is an example: System.out.println("DEBUG: Reminder day of month = " + reminder.getReminderDayofMonth()); calendar.set(Calendar.YEAR, reminder.getReminderYear()); calendar.set(Calendar.MONTH, reminder.getReminderMonth()); calendar.set(Calendar.DAY_OF_MONTH, reminder.getReminderDayofMonth()); calendar.set

How do I set the default date in a DatePickerDialog in my fragment from the host activity?

…衆ロ難τιáo~ 提交于 2019-12-13 03:38:20
问题 So I created a calendar object "c" in the Activity and set the date to February 29, 2016. I want the fragment dialog to load that date as the default date. What am I missing here? Do I need to delete the fragment calendar object 'cal'? If so, in the fragment onCreateDialog how do I reference or get() the date from the set() method in the Activity? from Activity file: @Override protected void onCreate(Bundle savedInstanceState) { ... final Calendar c = Calendar.getInstance(); c.set(Calendar

Cant set a calendar event on android 4.0 >

巧了我就是萌 提交于 2019-12-12 13:17:55
问题 I am making an app that access the android calendar and creates an event. It work fine in android 2.3, but in 4.0 > it do not creates the event and throws an exception I dont know what i am doing wrong, this is my code: public void addReminder() { Calendar beginTime = Calendar.getInstance(); long startMillis = beginTime.getTimeInMillis(); long endMillis = beginTime.getTimeInMillis() + 60 * 60 * 1000; String eventUriString = "content://com.android.calendar/events"; ContentValues eventValues =

How to get Calendar event by date range or month in android

南楼画角 提交于 2019-12-12 12:22:37
问题 I am using below code to get and load calendar events in my application. It's working perfectly. But now i want to get events specified date range. How can i get it.. Cursor cursor = getContentResolver().query( Uri.parse("content://com.android.calendar/events"), new String[] { "_id", "title", "dtstart", "dtend" }, null, null, "dtstart ASC"); should be dtstart = "2013-01-01" dtend= "2013-01-31" 回答1: This was what I implemented to retrieve the events: if (Integer.parseInt(Build.VERSION.SDK) >=

Adding events to native calendar is not working

て烟熏妆下的殇ゞ 提交于 2019-12-12 11:19:16
问题 I am working on an Android application. I have to add events to native Android calendar. So I tried the following code: if (Build.VERSION.SDK_INT >= 8 ) { l_eventUri = Uri.parse("content://com.android.calendar/events"); } else { l_eventUri = Uri.parse("content://calendar/events"); } Cursor cursor = getContentResolver() .query(Uri.parse(getCalendarUriBase(this)),new String[] { "calendar_id", "displayname"}, null,null, null); cursor.moveToFirst(); // fetching calendars name String CNames[] =

add android calendar events using java

核能气质少年 提交于 2019-12-12 08:59:08
问题 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

Display days, hours, minutes in between 2 dates in java

梦想与她 提交于 2019-12-12 06:36:41
问题 I need to display a countdown timer between a specified date in the future and now in the format Days:Hours:Minutes. So for example the end date is 4th december 1:30 PM 2013 and right now it is 3rd december 12:30 PM 2013, my textView (or any other view) should show "Time remaning 1 day: 1 hours: 0 minutes" I do not want to use joda-time library as it increases my applications size by about 4.1 MB and I need to use the date/time feature only once in my application. I am using the calendar API