Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add event to CalendarView

I think the question says it all: is it possible to display events in the Android default CalendarView?

I know that it is made for widgets and not for a real Calendar application but my app should not be a Calendar application. It is only a little feature in my app so I think the View is perfect for my claims. I only can't view events in it, otherwise it is perfect for me.

I read this answer and tried to overwrite the onDraw method from CalenderView:

@Override
protected void onDraw(Canvas canvas)
{
    p = new Paint();

    p.setColor(Color.RED);
    p.setStrokeWidth(10);

    super.onDraw(canvas);
    canvas.drawRect(0, 0, 100, 100, p);
}

But even this code does not work and no rectangle is displayed. The other 4 methods are private so I can't overwrite them. Any other ideas how I can solve this problem? I do not want to use a library, but if there is no other way I'm looking for something what is really near to the stock CalendarView. Or maybe I can create a calendar file which is only visible in my app and not in other calendar apps?

like image 417
Cilenco Avatar asked Feb 24 '14 22:02

Cilenco


1 Answers

You can't add events in default CalendarView. either you need to make it custom or you need to use some library.

I have used Caldroid library many times.it is easy to implement and robust.

enter image description here

like image 99
Mehul Joisar Avatar answered Oct 27 '22 22:10

Mehul Joisar