Android Java Textbox.append not working in new thread -


i created application uses socket connection server. server sends information string phone reads bufferedreader. want display information on screen(in textbox example) textbox.append command doesn't work in case. there no error @ runtime won't add string textbox. tried same textviews. here part of code. commands() function called in connect progress , variables declared @ beginning.

public void commands() throws exception{  responce = buffer.readline(); final textview textviewtochange = (textview) findviewbyid(r.id.textview1); textviewtochange.settext(responce);  commands(); } 

would nice if know how fix problem. :)

you need update ui on main ui thread. can use runonuithread below.

  runonuithread(new runnable() //run on ui thread                  {                   public void run()                    {                              textviewtochange.settext(responce);                  }                  }); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -