Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > J2ME, Canvas,

Reply
Thread Tools

J2ME, Canvas,

 
 
Boki
Guest
Posts: n/a
 
      03-23-2005
Hi, All,
I start up from a MIDlet and transfer to a GUI Canvas when
press a soft key, but the GUI.java
never answer my addCommand request ....

I mean, these soft buttons I add, they didn't show up on the screen, and I
my call code is :

====================
display.setCurrent(gui)
=======================

what's wrong...@@?

Best regards,
Boki.


 
Reply With Quote
 
 
 
 
Darryl Pierce
Guest
Posts: n/a
 
      03-24-2005
Boki wrote:
> I start up from a MIDlet and transfer to a GUI Canvas when
> press a soft key, but the GUI.java
> never answer my addCommand request ....


Please rephrase your message. It is very unclear. I understand that
you're displaying a class that extends Canvas, but what do you mean by
"never answer my addCommand request"? Do you mean you're creating an
instance of Command and calling Canvas.addCommand()?

If so, please post the code for where you create the Command, where you
create the Canvas and where you add the Command to the Canvas. Canvas
objects can and do display Commands, so the problem's in your code
somewhere...

--
Darryl L. Pierce <(E-Mail Removed)>
Visit my homepage: http://mcpierce.multiply.com
"By doubting we come to inquiry, through inquiry truth." - Peter Abelard
 
Reply With Quote
 
 
 
 
Boki
Guest
Posts: n/a
 
      03-24-2005
Hi Darry,
Thank you very much for your reply.
I solve this problem this morning already, I set a wrong

display.setCurrent ( XXX )

but, just now, I have another problem,

I create a Form from MIDlet and show it when MIDlet startApp(),

I will change the screen to GUI.java when I press a soft button,

right now, I can't back to the Form of MIDlet...

GUI.java ( extends Canvas ) can't destroy()..

I need help.

Best regards,
Boki.

"Darryl Pierce" <(E-Mail Removed)>
???????:0Uy0e.51704$(E-Mail Removed) et...
> Boki wrote:
>> I start up from a MIDlet and transfer to a GUI Canvas when
>> press a soft key, but the GUI.java
>> never answer my addCommand request ....

>
> Please rephrase your message. It is very unclear. I understand that you're
> displaying a class that extends Canvas, but what do you mean by "never
> answer my addCommand request"? Do you mean you're creating an instance of
> Command and calling Canvas.addCommand()?
>
> If so, please post the code for where you create the Command, where you
> create the Canvas and where you add the Command to the Canvas. Canvas
> objects can and do display Commands, so the problem's in your code
> somewhere...
>
> --
> Darryl L. Pierce <(E-Mail Removed)>
> Visit my homepage: http://mcpierce.multiply.com
> "By doubting we come to inquiry, through inquiry truth." - Peter Abelard



 
Reply With Quote
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      03-24-2005
"Boki" <(E-Mail Removed)> writes:

> right now, I can't back to the Form of MIDlet...
>
> GUI.java ( extends Canvas ) can't destroy()..


Why not add a Comand to GUI.java that will let you switch back to the
form?
 
Reply With Quote
 
Boki
Guest
Posts: n/a
 
      03-24-2005
sure, do you mean

when I press a soft button
and that perform:

display.setCurrent( Main form ) ?

Best regards,
Boki.

"Tor Iver Wilhelmsen" <(E-Mail Removed)>
???????:(E-Mail Removed)...
> "Boki" <(E-Mail Removed)> writes:
>
>> right now, I can't back to the Form of MIDlet...
>>
>> GUI.java ( extends Canvas ) can't destroy()..

>
> Why not add a Comand to GUI.java that will let you switch back to the
> form?



 
Reply With Quote
 
Darryl Pierce
Guest
Posts: n/a
 
      03-26-2005
Boki wrote:
> but, just now, I have another problem,
>
> I create a Form from MIDlet and show it when MIDlet startApp(),
>
> I will change the screen to GUI.java when I press a soft button,
>
> right now, I can't back to the Form of MIDlet...
>
> GUI.java ( extends Canvas ) can't destroy()..


I'm sorry, the language barrier is really hard to get past. If you have
a Displayable object, such as a Form, then calling
Display.getDisplay([your active MIDlet]).setCurrent([the Displayable])
will change the active display to the one you passed in. Can you post
the code where you're changing the display please?

--
Darryl L. Pierce <(E-Mail Removed)>
Visit my homepage: http://mcpierce.multiply.com
"By doubting we come to inquiry, through inquiry truth." - Peter Abelard
 
Reply With Quote
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      03-26-2005
"Boki" <(E-Mail Removed)> writes:

> when I press a soft button
> and that perform:
>
> display.setCurrent( Main form ) ?


Yes.
 
Reply With Quote
 
Boki
Guest
Posts: n/a
 
      03-26-2005
I got it.
By the way, could we destroy it to release memory?

Thank you very much.

Best regards,
Boki.

"Tor Iver Wilhelmsen" <(E-Mail Removed)>
???????:(E-Mail Removed)...
> "Boki" <(E-Mail Removed)> writes:
>
>> when I press a soft button
>> and that perform:
>>
>> display.setCurrent( Main form ) ?

>
> Yes.



 
Reply With Quote
 
Darryl Pierce
Guest
Posts: n/a
 
      03-26-2005
Boki wrote:
> I got it.
> By the way, could we destroy it to release memory?


No. Garbage collection is out of your hands with all forms of Java. You
can only dispose of all references to the Object; the VM will reclaim
memory when it needs it.

--
Darryl L. Pierce <(E-Mail Removed)>
Visit my homepage: http://mcpierce.multiply.com
"By doubting we come to inquiry, through inquiry truth." - Peter Abelard
 
Reply With Quote
 
Boki
Guest
Posts: n/a
 
      03-26-2005
I got it!

Thank you a lot !

Best regards,
Boki.

"Darryl Pierce" <(E-Mail Removed)>
???????Ob1e.67781$(E-Mail Removed) et...
> Boki wrote:
>> I got it.
>> By the way, could we destroy it to release memory?

>
> No. Garbage collection is out of your hands with all forms of Java. You
> can only dispose of all references to the Object; the VM will reclaim
> memory when it needs it.
>
> --
> Darryl L. Pierce <(E-Mail Removed)>
> Visit my homepage: http://mcpierce.multiply.com
> "By doubting we come to inquiry, through inquiry truth." - Peter Abelard



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments