Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 1,533
Registered: ‎07-14-2008
My Device: Z10

Re: how to create calendar popup

thanks peter.  will have try it out.

 

RIM should have included all the basic controls like calendar, color picker, file picker, etc.. in the SDK to start with.

Trusted Contributor
Posts: 151
Registered: ‎06-17-2010
My Device: Curve 8900

Re: how to create calendar popup

this is really very nice..:manvery-happy:

New Contributor
Posts: 2
Registered: ‎11-01-2010
My Device: Not Specified

Re: how to create calendar popup

thanks peter, this is good one..

 

just a little bit change when the start day is MONDAY, it think it should be

    startAt = 0;

instead of

   startAt = -6

 

        switch (workDay) {
            case(Calendar.MONDAY): {
                startAt = 0;
                break;
            }
            case(Calendar.TUESDAY): {
                startAt = -1;
                break;
            }

so when the month start with Monday (just like Nov 2010), the calendar won't show the Tuesday at the left column.

 

the rest of the code, works just fine.

 

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to create calendar popup

Thanks for that correction.

 

I think I found this code was very slow, hope you are not finding the same.

New Contributor
Posts: 2
Registered: ‎11-01-2010
My Device: Not Specified

Re: how to create calendar popup

Yes, it's bit slow.. i'm trying to find another solution...  i'll post it here if i find one. (or code one  :smileyhappy: )

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to create calendar popup

The reason I think it is slow is that it adds and deletes fields.  One option is to do the adding 'offline' in other words add the Fields to a manager that is NOT connected to a screen, then add the manager to the screen, that way, the layout processing is only done once.

Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified

Re: how to create calendar popup

Hi Peter,

 

Very nice calendar implementation.  I want to try to get a working version on the Storm.  Did you ever figure out why it doesn't work with the Storm? Or do you have any assumptions?  When I try to run your application, I receive the following error:

 

"ArrayIndexOutOfBoundsException"

 

"Uncaught Exception: Index 1 >= 1"

 

And stack trace:

 

Thread [Calendar(188)id=288674816] (Suspended (exception ArrayIndexOutOfBoundsException))    
    CalendarScreen$1(DateField).prevDateTimeBoundarySubfield(int) line: 1877    
    CalendarScreen$1(DateField).calcLayoutData(int) line: 550    
    CalendarScreen$1(DateField).calcCachedData() line: 703    
    CalendarScreen$1(DateField).onFocus(int) line: 2112    
    VerticalFieldManager(Manager).onFocus(int) line: 3500    
    TitleStatusManager(Manager).onFocus(int) line: 3500    
    CalendarScreen(Screen).onFocus(int) line: 3821    
    CalendarScreen(Screen).onDisplay() line: 3753    
    CalendarScreen(Screen).callOnUiEngineAttached(boolean) line: 496    
    UiEngineImpl.addScreen(Screen) line: 1471    
    UiEngineImpl$UiEngineOldInterfaceAdapter.pushScreen(Screen) line: 5994    
    Application(UiApplication).pushScreen(Screen) line: 277    
    Application.<init>() line: 8    
    Application.main(String[]) line: 13   

 

Thanks!

Regular Contributor
Posts: 62
Registered: ‎04-06-2011
My Device: Blackberry developer

Re: how to create calendar popup

I get the same error. Which can be the problem?

Thanks,

Albert

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to create calendar popup

[ Edited ]

@behrk2 - Sorry missed this.

 

In OS 4.7 I would use DateTimePicker. 

 

I actually have got this code working in OS 4.7 myself but for OS 4.7 and above push people towards the built in picker.

 

I can look at trying to fix this if you want, but I think this code is 'dead' for any current OS.

Regular Contributor
Posts: 62
Registered: ‎04-06-2011
My Device: Blackberry developer

Re: how to create calendar popup

Why is dead?
My error is happening working in 5.0 in blackberry 9550.
It is the only one that get this error...
Thanks Peter for your help
Albert