Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User metebalci's Avatar
    Join Date
    Apr 2005
    Posts
    39
    Basically, I need to switch between two canvases. One for midp 1.0 using nokia ui api, and the other is full canvas provided by midp2.0

    Is it possible to run a code on the phone that detects midp2.0 and use corresponding canvas ?

    I know how to detect midp version. What I am asking is if it is possible in a class loader / jvm point of view. I have read some messages that class loader must load all the classes that is referenced in the application before running the application. Does it depend on phone model/firmware ?

    Thanks in advance.

    MB

  2. #2
    Super Contributor shmoove's Avatar
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    You can use Class.forName() and Class.newInstance() to discover what classes are supported and instantiate the appropiate canvas.

    You can see an example in Nokia's own Block Game.

    shmoove

  3. #3
    Registered User cervera's Avatar
    Join Date
    Mar 2003
    Location
    Copenhagen, Denmark
    Posts
    14
    I woudl use System.getProperty("microedition.profiles")
    - to test for the MIDP version.


    Unfortunately Class.forname("xxx"); will only throw an ClassNotFoundException, if the name startswith "com.nokia..xxxxx" Anything else, e.g. like:
    Class.forname("javax.microedition.io.SocketConnection");
    or
    Class.forName("javax.microedition.media.Player");
    will NOT throw ClassNotFoundException or any other exceptions...The program breaks down with this message:
    "cannot create class in system package" ....

    Cervera

  4. #4
    Super Contributor shmoove's Avatar
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    The program gives you the "cannot create class in system package" because somewhere you have an import statement or an explicit instantiation of the unsupported class.

    shmoove

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved