When calling any of the public connect() methods from an Activity, these all route to the core connect() method that spawns a SocketThread.
Code like this executes a few times while the connection is being established. If you call connect() from the main thread, and plan on doing subsequent UI updates, this can be problematic.
synchronized (mSocketThread) {
try {
mSocketThread.wait();
} catch (InterruptedException e) {
}
}
This causes the main thread to block for long periods in certain situations, such as a connection taking a long time to establish. This is not ideal in situations where the UI needs to show a status of the connection. With a little refactoring, I think these waits can probably be removed to fix this.
When calling any of the public connect() methods from an Activity, these all route to the core connect() method that spawns a SocketThread.
Code like this executes a few times while the connection is being established. If you call connect() from the main thread, and plan on doing subsequent UI updates, this can be problematic.
This causes the main thread to block for long periods in certain situations, such as a connection taking a long time to establish. This is not ideal in situations where the UI needs to show a status of the connection. With a little refactoring, I think these waits can probably be removed to fix this.