J2ME, Can't call notifyDestroyed() from Canvas...

B

boki

Hi, All,
Can I call notifyDestroyed() from Canvas...?

XXX extends Canvas()
{
....
MIDlet.notifyDestroyed();
....
}


Erorr Output:
-----------------------
non-static method notifyDestroyed() cannot be referenced from a static context
-----------------------

If I want to call notifyDestroyed() from Canvas, how should I do ?


Thank you very much.

Best regards,
Boki.
 
D

Darryl Pierce

boki said:
Hi, All,
Can I call notifyDestroyed() from Canvas...?

You can call it from *anywhere*, provided you have a reference to the
*active* MIDlet.
 
Joined
Sep 7, 2009
Messages
1
Reaction score
0
may be i am late about 4 years , but for every one who will read this ,

a just crash into the same problem ,so i came up with this solution....

MidleCLass{

public static MidletCLass ME;

public MidletCLass(){

MidletCLass.ME = this;
}

}

after this... you can reference the notifyDestroyed() from anywhere else
, and from any canvas class in the project by this code:

MidletCLass.ME.notifyDestroyed();

and you only spend a tiny amount of memory for a reference toward the midlet


enjoy;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,118
Latest member
LatishaWhy
Top