10-04-2005, 03:32 PM
|
#1 (permalink)
|
| New Member
Join Date: Sep 2005 Model: 7250
Posts: 10
Post Thanks: 0 Thanked 0 Times in 0 Posts
| blocking operations in event dispatch thread Please Login to Remove! I'm trying to write an app which creates a socket connection to a remote server and writes a command string to it. It worked fine in the simulator, but when I copied it to the handheld, I got an error about blocking operations not being permitted in the event dispatch thread. Next, I tried creating a Runnable object and using InvokeLater, like this:
Runnable sendQuery = new Runnable() {
public void run() {
try {
StreamConnection conn = null;
conn = (StreamConnection)Connector.open(URL);
OutputStreamWriter _out = new OutputStreamWriter(conn.openOutputStream());
String data = "query " + myContextField.getText() + "\n";
int length = data.length();
_out.write(data,0,length);
_out.close();
conn.close();
}
catch (Exception e) {
Dialog.inform("Error: " + e);
}
}
};
invokeLater(sendQuery);
But I get the same thing. What do I need to do?
Thanks! |
| Offline
| |