instaceof CalendarDayCell

9 posts, 0 answers
  1. Jeremy
    Jeremy avatar
    4 posts
    Member since:
    Mar 2015

    Posted 27 Apr 2015 Link to this post

    Hi, 

     

    I follow the tutorial on the documentation but i have a little problem and i can't solve it ...

     

    if (!(calendarCell is CalendarDayCell))
                {
                    return;
               }

     

    This function always return. I don't understand what does this test mean and why it does not success

     

    Hope you can help me ! 

     

    Thanks

  2. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 04 May 2015 Link to this post

    Hello Jeremy,

    Thank you for contacting the Android team!

    The cells in year mode are represented by CalendarMonthCell and in month and week mode by CalendarDayCell.

    Thank you for your time and all best!

    Regards,
    Antony Jekov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. DevCraft banner
  4. Jeremy
    Jeremy avatar
    4 posts
    Member since:
    Mar 2015

    Posted 04 May 2015 in reply to Antony Jekov Link to this post

    Hello Antony, thanks for your reply ! 

     

    I am actually in week mode so it shoud be CalendarDayCell right ?

     

    Thanks

    Jérémy

  5. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 04 May 2015 Link to this post

    Hello Jeremy,

    Yes, and you can check further by using getCellType() to check if the cell is Date, DayName or WeekNumber.

    Regards,
    Antony Jekov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  6. Jeremy
    Jeremy avatar
    4 posts
    Member since:
    Mar 2015

    Posted 04 May 2015 Link to this post

    Ok, so why it doesn't work ?

     

    When i click on a Cell, the test always return false, i don't understand why ..

  7. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 07 May 2015 Link to this post

    Hello Jeremy,

    I confirmed that this code doesn't work indeed. It is supposed to work according to the official documentation of the keywords in the .NET platform - Reference here, but it seems that Mono or Xamarin are behaving differently. I will log this and the examples will be revisited regarding this issue.

    Thank you for your feedback!

    Regards,
    Antony Jekov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  8. Jeremy
    Jeremy avatar
    4 posts
    Member since:
    Mar 2015

    Posted 07 May 2015 in reply to Antony Jekov Link to this post

    Hi,

     

    As same for the  GetFormattedTime function, String doesn't work , you should use string with lowcase, and it's work. 

    Like this : 

     

    private string GetFormattedTime(string format, long time)
    {
    Calendar calendar = Calendar.Instance;
    calendar.TimeInMillis = time;
    DateTime dateTime = new DateTime(
    calendar.Get (CalendarField.Year),
    calendar.Get (CalendarField.Month) + 1,
    calendar.Get (CalendarField.DayOfMonth),
    calendar.Get (CalendarField.HourOfDay),
    calendar.Get (CalendarField.Minute),
    calendar.Get (CalendarField.Second));
    return string.Format (format, dateTime);
    }

     

    Jérémy 

  9. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 12 May 2015 Link to this post

    Hello Jeremy,

    Thank you for your feedback. We will review it at our earliest convenience.

    Thank you for your time and all best!

    Regards,
    Antony Jekov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  10. Trey
    Trey avatar
    2 posts
    Member since:
    Sep 2015

    Posted 02 Nov 2015 Link to this post

    I just had this issue resolved today in the event that someone else encounters this problem. This is what I was told to do:

    Instead of:


    if(!(calendarCell is CalendarDayCell))
    {
        return;
    }

    CalendarDayCell calendarDayCell = (CalendarDayCell) calendarCell;
    You need to use:


    if (calendarCell.Class.SimpleName == "CalendarMonthCell") {
        return;
    }

    CalendarDayCell calendarDayCell = calendarCell.JavaCast<CalendarDayCell> ();

     

     

Back to Top
DevCraft banner