java - textbox stops working after recreation -


when app starts in onstart method:

if (mainactivity.s_polardeviceservice == null) {     mainactivity.s_polardeviceservice = new polardeviceservice(this, mhandler);     powermanager pm = (powermanager) getsystemservice(context.power_service);     powermanager.wakelock wl = pm.newwakelock(powermanager.partial_wake_lock, "my tag");     wl.acquire(); } 

polardeviceservice class regular class spawns thread connects/reconnects polar bluetooth device , reads data it.

when hit 'back' button on phone activity gets destroyed, , when spawn again gets recreated normally, controls on view not reacting. example, code, executed activity handler, has no effect:

sensordata sensordata =(sensordata) msg.obj; textview txtbpm = (textview) findviewbyid(r.id.text_output); textview txtminbpm = (textview) findviewbyid(r.id.text_min); textview txtmaxbpm = (textview) findviewbyid(r.id.text_max); textview txtavgbpm = (textview) findviewbyid(r.id.text_avg); textview txtsensorstatus = (textview) findviewbyid(r.id.txtsensorstatus); txtbpm.settext("bpm: " + sensordata.getbpm()); txtmaxbpm.settext("max: " + sensordata.getmaxbpm()); txtminbpm.settext("min: " + sensordata.getminbpm()); txtavgbpm.settext("avg: " + sensordata.getavgbpm()); 

what doing wrong?

thank you!

problem after recreation of activity, service still had old handler reference wasn't executing on new ui thread.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -