Android calendar view
Solution 1
I wrote Caldroid library (https://github.com/roomorama/Caldroid) that is simple to setup and have many features such as setup min/max date, disabled dates, select date range, swipe to change month, fully localized, support rotation properly etc. It's easy to customize the look and feel. Just to share if someone might find it useful :)
Solution 2
I tried android-CalendarView, Caldroid and later switched to android-times-square which has this improvements:
- Much faster switching to other months due to vertical scrolling (no pagination which responds slow in Caldroid)
- Indicators, highlighted dates (at least in this fork for android)
- iOS version available with the same look and feel
-
looks cleaner than the android version because months are clearly separated
Just like Caldroid it is a part of a productive app.
Solution 3
AFAIK, there are no other way than implement your own calendar. So... what you would have to do is using a GridLayout
with 7 columns and create a custom BaseAdapter
to display data correctly.
Solution 4
Android now provides three ways to incorporate calendars in your app.
Calendar view for picking dates and such.
Calendar provider can be accessed to add and remove events from the OS calendar.
Calendar intents allow you to provide a calendar without having to get extra permissions or deal with databases.
Solution 5
it is possible but not easy. http://jimblackler.net/blog/?p=151&cpage=2#comment-52767
and
private void InsertAppointment(String strTitle, String strDescription, String strEventLocation, long StartDateTime, long EndDateTime, boolean bAllDay, boolean bHasAlarm){
int tAllday;
int tHasAlarm;
if (bAllDay = true){
tAllday = 1;
}
else
tAllday = 0;
if (bHasAlarm = true){
tHasAlarm = 1;
}
else
tHasAlarm = 0;
ContentValues event = new ContentValues();
// Calendar in which you want to add Evenet
event.put("calendar_id", CalId); //CalId
event.put("title", strTitle);
event.put("description", strDescription);
event.put("eventLocation", strEventLocation);
event.put("dtstart", StartDateTime);
event.put("dtend", EndDateTime );
event.put("allDay", 0);
event.put("hasAlarm", 0);
Uri eventsUri = Uri.parse("content://com.android.calendar/events");
// event is added
getContentResolver().insert(eventsUri, event);
}
a quick search on
content://com.android.calendar/calendars
will help get you started. but I'm not finished mine yet I just can't get the data out yet. but it is possible
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on January 13, 2020Comments
-
Admin over 4 years
I'm pretty new to Android development and I'm looking for a means of including calendar in my Android application, but I'm striking out pretty bad when googling.
Is there any way to use a default calendar kind of view in my application? (would be ideal since the UI would be familiar)
Failing at a built-in option, are there any good libraries out there with a calendar control that I could use?
I'm not looking to sync and all of that (at least, at this point), just looking to have a calendar view that I can display information to the user.
-
THelper over 11 yearsUnfortunately this only works on API11 or later. It would be nice if someone created a good backport so you can support 2.x versions
-
Adil Malik over 11 yearsDid you successfully add the default calendar to your app? Please let me know. I need some help on this. Thanks
-
Vikas Gupta about 11 yearshey i used your calendar, and its awesome. but i need to set events on date. like i need to customize date colors according to event they have at that date. Can you give me a little idea how can i accomplish that?
-
thomasdao about 11 yearsYou can supply your own view for each cell based on the date, you can find it in the documentation github.com/roomorama/… You can find how to use it in the sample as well
-
Vikas Gupta about 11 yearsI got stuck in this problem, can you please check? github.com/roomorama/Caldroid/issues/24
-
thomasdao about 11 yearsYes I replied to ur issue
-
Tofeeq Ahmad almost 11 years+1 for your good work
-
deeJ almost 11 yearsMuch appreciated. Thanks.
-
Dr. aNdRO over 10 years@VikasGupta Can you please tell me how you fetched all the events and displayed over to caldroid?
-
Vikash Parajuli about 9 yearsSir how to make single row (week view) calendar using Caldroid ?
-
A J about 9 yearsCan you please check this issue - github.com/roomorama/Caldroid/issues/280
-
Filip over 8 yearsGreat Job! Is there a possibility to dinamically color (highlight) certain arbitrary dates (in order to provide user with some app-specific info)?
-
Filip over 8 years"Indicators, highlighted dates (at least in this fork for android)" - is this also possible in Caldroid? I am in two minds whether to chose caldroid or this one, and I need higlighting dates... Thanks.
-
Vinodh Kumar over 7 yearsHi Philippe i m using above calender view.every working fine i need to set the calender year at 1990 how to do this?can you help me
-
Vignesh about 5 yearsIs this library supports vertical scrolling?