android - Invalidate () crashing -


i sending data class desired change layout. send data followinf way:

while(connected){

    //receive data through socket       in = new bufferedreader(new inputstreamreader(socket.getinputstream()));      while ( (line = in.readline()) != null){          string [] aarray = line.split("[^\\d]+");                           if (aarray != null){               for(int = 0; < aarray.length; i++){                 number = integer.parseint(aarray[i]);                     }                 }                 log.d(tag, "line " + string.valueof(line));                              mycompassview.updatedirection(number); 

the updatedirection calls following function:

public void updatedirection(float dir){      direction = dir;     log.d(main.tag, "mudou direction " + string.valueof(direction));      invalidate();  } 

and wanted invalidade() call ondraw(canvas canvas) function again, instead making application crash.

i don't understand problem, though invalidate() pretty straight forward.

if me, appreciate it.

use postinvalidate() instead. or:

runonuithread(new runnable () { @override public void run() {     invalidate(view) } }); 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -