Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

GreogorianCalendar!? how to work it out

 
omar bili
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
i'm trying to convert a normal class to a midlet, this class contain an instance of the GregorianCalendar... the j2me classes dont contain GregorianCalendar it only have the interface Calendar (surely i cant create an instance of this class)
is there a way to solve that??
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't there a Calendar.getInstance() method that returns a Calendar? Then you have an instance of an object that is of type Calendar. This allows the phone manufacturer to implement their Calendar version and the getInstance will return that one.

Mark
 
payal agrawal
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the URL below:

How to display Calendar in mobile device
http://www.java-tips.org/content/view/421/73/
 
omar bili
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wow getInstance worked, but please can you tell me how was that??
the Calendar is an interface.. what does this function return!?!?
and is it function that exists in a lot of interfaces??
thanks for the help.
Omar
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!