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
Post a Comment