I have the following function:
String[] TXbuffer = new String[]{"H","o","l","a"};
public void writeAsync(String bufferx) {
if ( mSerialPort != null) {
try {
mSerialPort.write(bufferx.getBytes(), SERIAL_TIMEOUT);
} catch (IOException e) {
}
} else {
mTitleTextView.setText("Dispositivo Serial Desconectado!");
}
}
and I want to call it from another function:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.bt2_TX) {
writeAsync(TXbuffer);
return true;
}
}
Someone can tell me how to do it correctly, because I have an error!