BlackBerry
 





Home > Worldwide Developers > Java Knowledge Base Search > Knowledge Base Article

Java Knowledge Base

Knowledge Base Article

Why does the application that I created stop responding on a live handheld when I establish a network connection, even though it works in the simulator?

Article Information: You should always establish an HTTP network connection on a separate thread so that your network request does not block the main user interface thread. If an application establishes a network connection on the main thread, it should work in the simulator, although the user interface will not be accessible until the connection completes. However, this approach will not work on a live handheld for the following reason.

The BlackBerry handheld includes a local firewall that prompts the user to accept or deny a network connection after an application makes a network request. If the network request is made on the main thread, the user interface is blocked until the connection completes. However, the connection cannot complete until the user selects Accept this connection on the firewall User Interface screen. Because the main thread is blocked by the network request, this screen cannot be displayed - the user interface and the network connection are waiting for each other. To resolve this, move your network request onto a separate thread so that it does not interfere with the main user interface thread.


More Information:

       
 Legal | Copyright © 2002 Research In Motion Limited, unless otherwise noted.