Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 142
Registered: ‎12-15-2008
My Device: Not Specified

What's causing my app to restart after an invocation?

(Storm app)
When my app displays an image via registry.invoke, i close the app via System.exit(0) and then my app restarts for some reason.
Here is the sequence...

in my navigationClick routine I call the following thread:

public class DisplayImage extends Thread
{
public void run()
{
try {
Invocation invocation;
invocation = new Invocation ("file:///store/samples/pictures/Cascade.png");
Registry _registry=Registry.getRegistry("net.rim.device.api.content.BlackBerryContentHandler");
_registry.invoke(invocation);
} catch (IOException e){}

try {
Thread.sleep( 500L );
} catch( InterruptedException e ) {}

System.exit(0);
}
}

The image displays. After I start this thread in my navigationClick method i return from the method with a
return super.navigationClick (status, time);

The image is on the screen and if i look at the task manager there is no icon for my app present so I assume my app has succesfully closed.
However if i cancel out of this image by hitting the cancel key my app is restarted. What's going on here?
Developer
Posts: 142
Registered: ‎12-15-2008
My Device: Not Specified

Re: What's causing my app to restart after an invocation?

Nevermind, figured it out.
I needed to add the following call:

invoc.setResponseRequired(false); // We don't require a response