Jump to content

HELP in J2ME MIDlet

- - - - -

  • Please log in to reply
5 replies to this topic

#1
edge02

edge02

    Newbie

  • Members
  • PipPip
  • 21 posts
Hi, can anyone tell me how to call another form in Java MIDlet?
I'm trying to make 2 seperate java midlet, the main form
will call or show the second java midlet, but i dont know
what function or code to use. Is this even possible or
i just have to use inheritance and extends? thanks.

#2
farrell2k

farrell2k

    Learning Programmer

  • Members
  • PipPipPip
  • 60 posts
To load one form from another, you use the setCurrent() method of the Display class.

#3
edge02

edge02

    Newbie

  • Members
  • PipPip
  • 21 posts
ok i'll try that, but i think that method is only used for java applet
hope that also work for midlets.

#4
farrell2k

farrell2k

    Learning Programmer

  • Members
  • PipPipPip
  • 60 posts
If you check the link in my signature, you'll see that I have an OVI store app written in J2ME. what I told you is how you do it. It has nothing to do with applets.

#5
edge02

edge02

    Newbie

  • Members
  • PipPip
  • 21 posts
i tried get display.getDisplay() and .setCurrent() method but it doesnt work
i'm having an error and it says "java.lang.SecurityException: Application not authorized to access the restricted API"

btw heres my code:

Posted Image
Posted Image
Posted Image
Posted Image

where part1-3 is my main midlet and part4.jpg is the second midlet that i want to display after selecting "Acceleration in the menu list(main form)".
the codes is in part2.jpg in the public void testItem1() function. can you tell whats wrong?
thanks.

#6
farrell2k

farrell2k

    Learning Programmer

  • Members
  • PipPipPip
  • 60 posts
Your problem is that you're trying to start one midlet from another. One application, one midlet. Make your Acceleration class extend Form, instead. Then when you want to display that form, just do it from your first midlet.

Your main meny midlet displays its form, then when you want to change screens, just setCurrent(accel) the next screen (form).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users