destroyXlet() question

Hi, I've a little problem, I can't see the video (elementary stream) when I destroy my xlet. I've two classes, one implementsXlet interface and thedestroyXlet method I've implemeted is:

publicvoid destroyXlet(boolean unconditional)throws XletStateChangeException

{

if (unconditional)

{

if (escena !=null)

{

escena.setVisible(false);

HSceneFactory.getInstance().dispose(escena);

escena.dispose();

escena =null;

}

else

{

thrownew XletStateChangeException("Por favor, no me dejes morir!");

}

}

}//destroyXlet()

In the other class I implementKeyListener interface and in tehkeyPressed method I put:

publicvoid keyPressed(KeyEvent e)

{

switch(e.getKeyCode())

{

case 3:

{

contexto.notifyDestroyed();

break;

}

}

wherecontexto is a variable defined in the first class that I pass as argument from the first class to the second one:

public XletContext contexto;

It seems that the xlet dies ok because I can start another time the application pressing application button (OK button inmy case). But I would like to see video stream and no a black screen when the application is destroyed.

Anay ideas? Thanks in advance

[2349 byte] By [leireurrizaa] at [2007-10-3 6:09:45]
# 1

i'm not exactly sure but i don't think notifyDestroyed() really destroys the xlet. it just tells the receiver you're gonna call destroyXlet() so it can prepare for that.

and the scene doesn't do anything with your video. unless you paint anything over it, you should still see it running.

_elBoB_a at 2007-7-15 0:53:04 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 2
Thank you for your comment. I've solved it, the problem was the way that I used to create the player. I've changed it and now I get the player from the current service instead of creating a new one. Now it works fine
leireurrizaa at 2007-7-15 0:53:04 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 3

> i'm not exactly sure but i don't think

> notifyDestroyed() really destroys the xlet. it just

> tells the receiver you're gonna call destroyXlet() so

> it can prepare for that.

>

> and the scene doesn't do anything with your video.

> unless you paint anything over it, you should still

> see it running.

Actually, AFTER you have voluntarily cleaned up the Xlet

( by calling destroy(boolean) yourself or by any other means )

you tell the system you ARE destroyed so the system can

set the state to destroyed; and it does not even need to

call destroy(boolean) any more!

Internally, however, middleware implementors know that

Xlet programmers could forget to clean up properly so a

good MHP implementation will force retraction of resources and

removal of listeners.

//Enver

ehaasea at 2007-7-15 0:53:04 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 4

that's the question:

steve morris writes: these methods (notifyDestroyed) should be called ... before the xlet enters the ... destroyed state.

so should we call notify destroyed right before we call destroyXlet? or clean up with destroyXlet und then notify we're ready to be finished?

_elBoB_a at 2007-7-15 0:53:04 > top of Java-index,Java Mobility Forums,Consumer and Commerce...