Hi,
I am developing an application to communicate with a device via bluetooth.
Same as the BluetoothChat sample, my application makes a service object,
and call service.connect() to get a connectedThread for data transmission.
and I have a command method, which takes an integer as its parameter.
the problem is, sometimes, that device returns invalid data.
So when I want to execute the command with ten different parameter, I need
to do something like :
for (i = 0; i < 10; i++) {
myService.write(command(i));
packet = *waitForResponse*(myService);
if (packet is valid) {
do something;
} else {
i--;
}
}
My program is using handler to deal messages, e.g. when the connectedThread
read some data, it will
mHandler.obtainMessage(ControlActivity.MESSAGE_READ, -1, -1, data)
.sendToTarget();
And there is a handler in my Activity class to deal with these messages.
How can I do something like *"waitForResponse"* on Android?
or Is there any other way to meet my requirement?
API Level: 13
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en