I got it working already, but now that I'm trying to improve it, I'm facing a problem. I want to run the LejosDroid.connect() method on a separate thread (not on the UI) so the buttons don't lag while it's trying to connect (1-3 seconds). Now the thing is, that whenever I put the method on another thread, it just crashes when I attempt to connect. I know you can't draw on the UI while in another thread (you have to do some stuff to do that) but regarding bluetooth, I didn't find any restriction.
I'd appreciate any kind of help on this problem, here is the simple code (remember, it works when not running on a separate thread):
- Code: Select all
public void handleConnectButton(View v) {
new Thread(new Runnable() {
public void run() {
conn = LeJOSDroid.connect(CONN_TYPE.LEGO_LCP);
}
}).start();
}

