android - How to show data from a BLE device in multiple Textviews? -


i have humidity sensor broadcasts last ten values single array after fixed time interval. want display these values in ten textview's.

my current code displays values in single textview, how can modify this? how possible?

@override public void oncharacteristicread(bluetoothgatt gatt,                                  bluetoothgattcharacteristic characteristic, int status) {     if (status == bluetoothgatt.gatt_success) {         if (bleuuid.read_sensor                 .equalsignorecase(characteristic.getuuid().tostring())) {             final string values = characteristic.getstringvalue(0);             byte[] bytes =values.getbytes();             final string value = new string(bytes);              runonuithread(new runnable() {                 public void run() {                     statuslv.settext(value);                     setprogressbarindeterminatevisibility(false);                 }             });  

split string receive.

depending on format, should able use this

string[] parts = string.split(","); //this should use character(s) separate results 

if want show results in 10 different textviews, can do

textview1.settext(parts[0]); textview2.settext(parts[1]); //... 

you put results in listview.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -