How to read and edit Android calendar events using the new Android 4.0 Ice Cream Sandwich API?

Here’s code that will let you add an event directly: import android.content.ContentResolver; import android.content.ContentValues; import; import android.provider.CalendarContract; import java.util.Calendar; // Construct event details long startMillis = 0; long endMillis = 0; Calendar beginTime = Calendar.getInstance(); beginTime.set(2012, 9, 14, 7, 30); startMillis = beginTime.getTimeInMillis(); Calendar endTime = Calendar.getInstance(); endTime.set(2012, 9, 14, 8, 45); endMillis = … Read more

Change CalendarView style

In my project I defined the attribute “android:calendarViewStyle” in my theme. <style name=”Theme.Custom” parent=”@android:Theme”> <item name=”android:calendarViewStyle”>@style/Widget.CalendarView.Custom</item> </style> <style name=”Widget.CalendarView.Custom” parent=”android:Widget.CalendarView”> <item name=”android:focusedMonthDateColor”>@color/cs_textcolor</item> <item name=”android:weekNumberColor”>@color/red</item> <item name=”android:weekDayTextAppearance”>@style/TextAppearance.Medium</item> <item name=”android:dateTextAppearance”>@style/TextAppearance.Medium</item> </style> All styles possibilities are: @attr ref android.R.styleable#CalendarView_showWeekNumber @attr ref android.R.styleable#CalendarView_firstDayOfWeek @attr ref android.R.styleable#CalendarView_minDate @attr ref android.R.styleable#CalendarView_maxDate @attr ref android.R.styleable#CalendarView_shownWeekCount @attr ref android.R.styleable#CalendarView_selectedWeekBackgroundColor @attr ref android.R.styleable#CalendarView_focusedMonthDateColor @attr … Read more

Android CalendarView for Showing Events

The built in CalendarView widget doesn’t expose the ability to change the color of the calendar cells in month view. See the source. You might try the following approaches: Extend from CalendarView and implement onDraw yourself. You’ll have to reimplement all the existing drawing behavior, including these 4 methods: protected void onDraw(Canvas canvas) { drawBackground(canvas); … Read more