radcalendar events

2 posts, 0 answers
  1. Paul
    Paul avatar
    3 posts
    Member since:
    Feb 2015

    Posted 28 Feb 2015 Link to this post

    I'm testing out radcalender in an application I'm writing. I'm having a tough time making events show up on the calendar for a month. I create the event in the event array and setEvents in the getEventAdapter. Finally I notifyDatachanged and nothing shows on the calendar. What am I doing wrong? I just want a blue event to show up in Feb 17, 2015. I'm following the example code and events just don't display.

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) {
    :
    :
        calendarView.getEventAdapter().setEvents(generateEvents2());
        calendarView.notifyDataChanged();
            
        return root;
    }

    private ArrayList<Event> generateEvents2() {
            ArrayList<Event> events = new ArrayList<Event>();

            Calendar c = getToday();
            String fromdate = "2015-02-17T18:00:00";
            String todate = fromdate;
           
            c = (stringToDateCalendar(fromdate));
            c.set(Calendar.HOUR_OF_DAY, 20);
            c.set(Calendar.MINUTE, 0);
            c.set(Calendar.SECOND, 0);
            c.set(Calendar.MILLISECOND, 0);
            long start = c.getTimeInMillis();
           
            c = (stringToDateCalendar(todate));
            c.set(Calendar.HOUR_OF_DAY, 20);
            c.set(Calendar.MINUTE, 1);
            c.set(Calendar.SECOND, 0);
            c.set(Calendar.MILLISECOND, 0);
            long end = c.getTimeInMillis();
           
            String desc = "booster stuff";
           
            Event eventitem = new Event(desc, start, end);
            eventitem.setEventColor(blueevent);
            events.add(eventitem);
            
            Collections.sort(events, new Comparator<Event>() {
                @Override
                public int compare(Event event, Event event2) {
                    return (event.getStartDate() < event2.getStartDate()) ? -1 : (event.getStartDate() > event2.getStartDate()) ? 1 : 0;
                }
            });
            
            return events;
    }

    private static Calendar stringToDateCalendar(String date1) {

       SimpleDateFormat form = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
       java.util.Date d1 = null;
       Calendar tdy1;
       
       try {
           d1 = form.parse(date1);
       } catch (java.text.ParseException e) {
           e.printStackTrace();
       }
       tdy1 = Calendar.getInstance();
       tdy1.setTime(d1);
       return tdy1;
    }

    private int getColor(String color)
    {
    int mycolor=0;
    if (color.toUpperCase().equals("BLUE"))
    {
    mycolor = blueevent;
    }
    if (color.toUpperCase().equals("GREEN"))
    {
    mycolor = greenevent;
    }
    if (color.toUpperCase().equals("ORANGE"))
    {
    mycolor = orangeevent;
    }
    if (color.toUpperCase().equals("PURPLE"))
    {
    mycolor = purpleevent;
    }
    if (color.toUpperCase().equals("RED"))
    {
    mycolor = redevent;
    }
    if (color.toUpperCase().equals("WHITE"))
    {
    mycolor = whiteevent;
    }
    if (color.toUpperCase().equals("YELLOW"))
    {
    mycolor = yellowevent;
    }
    return(mycolor);
    }



  2. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 04 Mar 2015 Link to this post

    Closing as duplicate of ticket 912059. 

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
Back to Top