Android Calendar API with Event - java

I am looking for way to get a calendar view with Event added on specific date something like the below:
And when I click on the calendar date another activity has to be opened?
Can the default calendar View help me doing the same or is there any other API that can help get the result like above?
Let me know!
Thanks!

You can use default calender library like
CalendarView
or you can use Caldroid

You can use default calendarview, I have used material calendarview for similar result.
You can even add events in text form as well as you can show drawable images with texts there.
See the line of code:
List<EventDay> events = new ArrayList<>();
events.add(new EventDay(calendar, CalendarUtils.getDrawableText(this, "₹"+wonAmt, Typeface.DEFAULT_BOLD, R.color.green, 8)));

Related

Create Horizontal View Calendar in Android Studio Java

I want a horizontal Calendar like this:
For creating a Horizontal Calender I have tried a few libraries like
implementation 'devs.mulham.horizontalcalendar:horizontalcalendar:1.3.4'.
But I am not able to access and customize an intemView.
Firstly clear me that can we access the itemView of devs.mulham.horizontalcalendar.HorizontalCalendarView, if yes then how and if not then how can I create my customer horizontal calendar in Java, Android studio?
Please help me out with this. Thank You!

Change DatePickerDialog style, to show a calendar instead of the scroller picker

Im using a DatePickerDialog on my app, and when it shows it looks like this
Im trying to change the look of it, to look like this one
This is how i declare my picker:
DatePickerDialog datepicker = new DatePickerDialog(getActivity(),
AlertDialog.THEME_DEVICE_DEFAULT_LIGHT,this,year,month,day);
According to a tutorial i was reading, if we pass AlertDialog.THEME_DEVICE_DEFAULT_LIGHT it should display the calendar like i want, but it does not work. Do i need something else?
Edit
Seems it might be an issue with Huawei(brand of the phone i was using) according to this
From the official docs -
When the DatePicker_datePickerMode attribute is set to calendar, the month and day can be selected using a calendar-style view while the year can be selected separately using a list.
According to datePickerMode doc -
Prior to the L release, the only choice was spinner. As of L, with the Material theme selected, the default layout is calendar.
So, if you are using the material theme in your Activity, then pass 0 in themeResId. This will make the dialog use the parent context's default alert dialog theme.
DatePickerDialog datepicker = new DatePickerDialog(getActivity(),
0 ,this,year,month,day);
Otherwise, you can use Theme_Material_Dialog_Alert or Theme_Material_Light_Dialog_Alert.
DatePickerDialog datepicker = new DatePickerDialog(getActivity(),
R.style.THEME_DEVICE_DEFAULT_LIGHT,this,year,month,day);

Sync Google Calendar events to Custom calendar using android studio

I manage to add events in google calendar and viewing the list of events but my problem is how can i sync those events to my custom calendar and the day must have a different color or any mark so that the user would know that the day has a event.
Try to check this documentation if this is the one you are looking for about syncing. Now, about the color of the events, you can set this different color in creating events by using the parameter colorId. For more information, check this SO question on how to do it in android code.

Remove and adjust Date Picker in android

Hey guys having issues with customizing the date picker in android. Here's an image of my current date picker.
As I've highlighted in black two things I'm having issues with.
Is there away to remove the header of the date picker? I just want the calendar part.
Is there a way to adjust the date picker so that it'll fit the width of any screen it's on?
I'm using a date picker not a date picker dialog.
to remove the header
datePickerDialog.setTitle("");
see the link,
Remove Title from DatePickerDialog
to get fullscreen, set android:layout_width to match_parent

Is it possible to override the android CalendarView methods?

I created an android calendar widgets. but I'm just wondering.. is it possible to override the method of CalendarView? what I really wanted is to display only the current month and daygridview not the previews days and next month days.. and I also want to remove the scrollView that allow the user to scroll up and down for the previous and next month.. I just want to have a simple calendar... Is there any body can help me please?..
this is the CalendarView that I wanted to customized..
XML CalendarView ScreenShoots
So then make a class that extends CalendarView and override according methods. There should not be a problem with it.
You could just create a gridView and set the # of columns as 7 for the # of days. Create an adapter that would then extend BaseAdapter. And in that class, you could set the # of grid cells as 42 as the max. possible grid cells is 7*6. Once done, as part of the getView() method, you could create a textview for each grid cell and fill that with the day of the month.
For setting the weekdays at the top, you could create another gridView with the same specs and set that as the headerView.

Categories