Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to call run() of Canvas from MIDlet ?

Reply
Thread Tools

How to call run() of Canvas from MIDlet ?

 
 
Boki
Guest
Posts: n/a
 
      04-27-2005
Hi All,
I want to restart the run() of Canvas from the call of MIDlet,
how to do it ?

Thank you very much.

Best regards
Boki.


 
Reply With Quote
 
 
 
 
Fred L. Kleinschmidt
Guest
Posts: n/a
 
      04-27-2005


Boki wrote:
>
> Hi All,
> I want to restart the run() of Canvas from the call of MIDlet,
> how to do it ?
>
> Thank you very much.
>
> Best regards
> Boki.


I do not understand what you mean. Canvas does not hava a run() method.

--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Common User Interface Services
M/S 2R-94 (206)544-5225
 
Reply With Quote
 
 
 
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      04-27-2005
"Boki" <(E-Mail Removed)> writes:

> I want to restart the run() of Canvas from the call of
> MIDlet, how to do it ?


Well, canvases usually don't have such a method; most likely your
class implements Runnable, and uses a Thread to do it.

Solution: Move the code creating and start() ing the thread somewhere
where you can start a new one. Make sure you check that the old thread
is dead (has exited) first.
 
Reply With Quote
 
Boki
Guest
Posts: n/a
 
      04-28-2005
Hi
Thank you very much for your reply.

If I want to check the thread is dead:

=========================
if ( myThread = null ) { ... } ;
=========================
Is that right? or add other variable/flag to detect?

Thank you very much for your help.

Best regards,
Boki.


"Tor Iver Wilhelmsen" <(E-Mail Removed)>
???????:(E-Mail Removed)...
> "Boki" <(E-Mail Removed)> writes:
>
>> I want to restart the run() of Canvas from the call of
>> MIDlet, how to do it ?

>
> Well, canvases usually don't have such a method; most likely your
> class implements Runnable, and uses a Thread to do it.
>
> Solution: Move the code creating and start() ing the thread somewhere
> where you can start a new one. Make sure you check that the old thread
> is dead (has exited) first.



 
Reply With Quote
 
Darryl Pierce
Guest
Posts: n/a
 
      04-28-2005
Boki wrote:
> I want to restart the run() of Canvas from the call of MIDlet,
> how to do it ?


Canvas doesn't *have* a run() method. If you're talking about restarting
a Thread, you would create a *new* Thread object...

--
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
 
bokiteam@ms21.hinet.net
Guest
Posts: n/a
 
      04-28-2005
Canvas extends Runnable



How about I new a thread but the same name, Does J2ME will delete the
prvious one automatically?

Best regards,
Boki.

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

> =========================
> if ( myThread = null ) { ... } ;
> =========================
> Is that right? or add other variable/flag to detect?


No, you call myThread.isAlive().
 
Reply With Quote
 
Boki
Guest
Posts: n/a
 
      04-29-2005
You are the one.

Best regards,
Boki.

"Tor Iver Wilhelmsen" <(E-Mail Removed)>
???????:(E-Mail Removed)...
> "Boki" <(E-Mail Removed)> writes:
>
>> =========================
>> if ( myThread = null ) { ... } ;
>> =========================
>> Is that right? or add other variable/flag to detect?

>
> No, you call myThread.isAlive().



 
Reply With Quote
 
Boki
Guest
Posts: n/a
 
      04-29-2005
Hi, I need you help.

I test keyPressed() that can't report soft keys on S700i, K700i, K750i...

I believe there is something wrong, but what should I do more?

I only get the value that keyPressed() evet bring to me...


and there is nothing happen when I press soft keys...


Thank you very much.

Best regards,
Boki.

"Tor Iver Wilhelmsen" <(E-Mail Removed)>
???????:(E-Mail Removed)...
> "Boki" <(E-Mail Removed)> writes:
>
>> =========================
>> if ( myThread = null ) { ... } ;
>> =========================
>> Is that right? or add other variable/flag to detect?

>
> No, you call myThread.isAlive().



 
Reply With Quote
 
Darryl Pierce
Guest
Posts: n/a
 
      04-29-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Canvas extends Runnable
>
>
>
> How about I new a thread but the same name, Does J2ME will delete the
> prvious one automatically?


If you assign a new instance of Thread to an existing Thread reference,
the old one will be garbage collected. However, you *must* end that
other thread's operation so that it's not consuming CPU resources...

--
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to couper contenier of a canvas in an outer canvas??? olsr.kamal@gmail.com Python 10 03-15-2013 08:46 PM
J2ME, Can't call notifyDestroyed() from Canvas... boki Java 4 09-07-2009 06:15 PM
MIDlet to calculate call timers Arlenx Java 0 05-03-2009 12:55 AM
Canvas with scrollbars - how to get correct canvas coordinate when the scroll bars have moved? PhilC Python 2 10-25-2004 11:57 AM
Canvas scrolling - scrollBar become "disabled" on change in canvas Askari Python 2 08-30-2004 02:56 PM



Advertisments