RadCalendarView: DisplayMode week

8 posts, 0 answers
  1. Anthony
    Anthony avatar
    6 posts
    Member since:
    Feb 2015

    Posted 04 Feb 2015 Link to this post

    Hi, I have a problem in Display mode to week. I'm working in Android Studio also the RadCalendarView library and I want to put the week view. I 've read this guide(http://docs.telerik.com/devtools/android/controls/calendar/calendar-display-mode) , this guide tell me that I have to write this code:

    calendarView.setDisplayMode(CalendarDisplayMode.Week);

    but it doesn't specify and i suppused it should be into the main_activity.java() :

    public class MainActivity extends ActionBarActivity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {...
    ...
    ...
    calendarView.setDisplayMode(CalendarDisplayMode.Week); 
      
    ...}

    But when i try to run the application there is an error and it don't run. So please anyone know how to get the weekview??





  2. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 05 Feb 2015 Link to this post

    Hello Anthony,

    Thank you for contacting the Android team.

    There are a few ways you can change the display mode and go to week mode. The one mentioned above is the default one, which will apply the change and will animate it or not, depending on your settings for animation.

    You get more control using the calendarView.changeDisplayMode(CalendarDisplayMode, boolean), where you can specify whether you want the change to be animated or not.

    However both ways must not produce any errors in your code. In order to call the methods you must have the calendar instantiated, and that is the only requirement.

    Can you please let me know exactly what type of error you are getting? It will help me to better understand your situation and provide you with a solution for this problem.

    Thank you for your time and all best!  

    Regards,
    Antony Jekov
    Telerik
     

    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
  4. Anthony
    Anthony avatar
    6 posts
    Member since:
    Feb 2015

    Posted 05 Feb 2015 in reply to Antony Jekov Link to this post

    Ok, first, I want to build an apk with a calendar with three views (year, month and week), the two first views i got it and I 've searched a the tutorial guide and I put the line code that I've mentioned above. But when I run the apk in a simulator it doesn't work and on Android Studio doesn't appear any error in the code ( http://prntscr.com/61d40x ). but in the logCat appears red messages but i don't know what is saying ( http://prntscr.com/61d4b0  http://prntscr.com/61d4lp  http://prntscr.com/61d4y5), and for that reason I don't know where is the problem. I've put links of some screens of my code and the logcat messages(http:// prints..), please help me.
  5. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 06 Feb 2015 Link to this post

    Hello Anthony,

    I can see a potential problem in the screenshots you sent me. First of all the problem is a NullPointerException. Now we must figure out where is it coming from. This error occurs when you try to invoke functionality of an object, that is not initiated (its null at the moment).

    I suspect that this line of code doesn't find the calendar and returns null:
    RadCalendarView calendarView = (RadCalendarView)findViewById(R.id.calendarView);
    Therefore on the next line you try to set the display mode, but since the calendar is still null you get a NullPointerException.

    Please make sure that you have the calendar defined somewhere in the activity_main.xml file, that you are using for the current activity. It should look something like this:
    <com.telerik.widget.calendar.RadCalendarView
            android:id="@+id/calendarView"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    Please let me know how this goes. I am pretty sure that would be the problem.


    Thank you for your time and all best!

    Regards,
    Antony Jekov
    Telerik
     

    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.

     
  6. Anthony
    Anthony avatar
    6 posts
    Member since:
    Feb 2015

    Posted 06 Feb 2015 in reply to Antony Jekov Link to this post

    Hello Antony, I forget tell you that my android studio project has fragment_main.xml and I've written this: 

    <com.telerik.widget.calendar.RadCalendarView ...      
     android:id="@+id/calendarView"      ....  >

    only on fragment_main.xml but Why it didn't work? I've put the line code above on activity_main.xml and it works but appears two calendars (one under one) I want to ask you how I should put the code (screenshot_4.png) if i have a project with fragment_main.xml? and thank you so much for your help.
  7. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 09 Feb 2015 Link to this post

    Hello Anthony,

    I feel like you are not quite comfortable using the Android platform yet. I think you will benefit more if you get in touch with the elements you are trying to use first. I am sending you two links, that will provide more info on the subjects of fragments and layouts.

    Our calendar is simply a view, so its layout is the same as of any other view. We are supporting the cases, that are more specific to the calendar, not the platform itself.

    You can refer to these resources: FragmentsLayouts

    I will proceed and close this ticket, since it is not related to our controls. Please feel free to start a new ticket, if you have some questions about the controls.

    Thank you for your time and all best!

    Regards,
    Antony Jekov
    Telerik
     

    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.

     
  8. Anthony
    Anthony avatar
    6 posts
    Member since:
    Feb 2015

    Posted 09 Feb 2015 in reply to Antony Jekov Link to this post

    Hi Antony

    Yeah i had some problems,  but i fixed that. I created another project without fragments and the projects works well, and it's easier for me. I gonna read the guides that you sent to me.

    Thank you for your help
  9. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 09 Feb 2015 Link to this post

    Hey Anthony,

    I am glad I was of help. I am closing the ticket now.

    Good luck with your project!

    Regards,
    Antony Jekov
    Telerik
     

    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.

     
Back to Top
DevCraft banner