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
Trusted Contributor
jppedroso
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520
My Carrier: TMN

Calendar.getInstance() exception

Hi,

 

I'm having a NumberFormatException when executing:

Calendar cDay = Calendar.getinstance();

 

Please help!

................................................................................................
Tech On!
PTNews
more at On On On!
Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900
My Carrier: Not Specified

Re: Calendar.getInstance() exception

[ Edited ]

Try this: 

 

 final DateTimePicker datePicker = DateTimePicker.createInstance( Calendar.getInstance(), "yyyy-MM-dd", null);
datePicker.doModal();
Calendar cal = datePicker.getDateTime();
final int month = cal.get(Calendar.MONTH);
final int year  = cal.get(Calendar.YEAR);

 Like this you can get month or year or date;

If any doubt see this link:  (DateTimePicker)

http://www.blackberry.com/developers/docs/5.0.0api/index.html

 

=============================================================================

Feel free to click right side THUMB symbol;

 

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
Trusted Contributor
jppedroso
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520
My Carrier: TMN

Re: Calendar.getInstance() exception

Hi, can anyone explain why Calendar.getInstance() is throwing a NumberFormatException ?

 

This is the initialization of the cDay Calendar...this is the first stament that calls Calendar.

 

Must I code something before?

 

Is it related with Eclipse? I'm using version 5.0 of BB SDK.

 

Please help!

................................................................................................
Tech On!
PTNews
more at On On On!
Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900
My Carrier: Not Specified

Re: Calendar.getInstance() exception

Did you tried the above code...........?
=============================================================================
Feel free to click right side THUMB symbol;
=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.