android - update UI from and event -


i have service sends continously values activity through custom event listeners.

here works fine. values displayed in activity expected, others make application crash. because of incoming data calculated inside normal thread (that cannot have access changing it), , know have use handler here, far tried app still crashing.

more graphically following

onvalueschanged(float val) {    mytextview.settext( float.tostring(val) ) }  

where val calculated in normal thread, of course makes crash app when doing settext.

any suggestions?

use asynctask instead of thread , in onpostexecute() can update ui.

or use activity.runonuithread(new runnable() { void run() { // interesting. } });


Comments

Popular posts from this blog

razor - Is this a bug in WebMatrix PageData? -

c# - How to set Z index when using WPF DrawingContext? -

c# - Cloning WPF controls and object hierarchies -