I'm still learning how to program for my Blackberry so my first program is a simple one that will retrieve an image file from a server using a TCP/IP connection.
I have two threads in my program. One is the main thread that constructs the UI and then starts the second thread which handles the retrieval of image data over TCP/IP.
I can successfully retrieve the data from the server into a byte array but I'm stumped as to how to get the data from my "network" thread to my main thread. I haven't had much luck finding tutorials that explained this in depth. The one bit of sample code I did find doesn't want to compile, but it is supposed to update the _content field's text that is on the MainScreen. From what I've read I'm supposed to be able to call the updateContent routine which will in turn modify the control on the main screen. I tried calling a routine in my main thread from within the updateContent routine but it doesn't work. It's as if the routines and functions within my main thread are private. However, I made the class public. I get a compiler error of "cannot find symbol"
Code:
private void updateContent(final String text) {
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
_content.setText(text);
}
});
} I'm lost with this. Can anyone point me toward a decent tutorial with samples or post a snippet here?