my android program able receive string "test" or "test 123".
now, need receive specific strings incoming data.
in example: ~100 *200 $300.
how can separate these 3 data filtering symbol, such textbox1 = "100", textbox2 = "200" , textbox3 = "300"?
please help.
this current bluetooth code.
private byte read() { byte dataread = 0; try { dataread = (byte) inputstream.read(); } catch(ioexception readexception) { toasttext = "failed read input stream: " + readexception.getmessage(); toast.maketext(trial_blood_pressure.this, toasttext, toast.length_short).show(); } return dataread; } if (flag) { final byte data = read(); readmessagehandler.post(new runnable() { public void run() { string message; if (data != 1){ /* if(txtreceived.gettext().tostring().equals("on") || txtreceived.gettext().tostring().equals("off")) { txtreceived.settext(""); }*/ message = txtreceived.gettext().tostring() + (char)data;} else{ message = "";} txtreceived.settext(message); } }); }
use same separator. i.e.: "100$200$300"
.
can use string.split()
create string array contains separate values.