java - How much of this code should be inside the UI Thread? -
so have asynctask doing work in background. work list of commands done in loop. commands may run following method (inside loop): public void print() { // create , add textview // variable "c" activity reference, in constructor passing "this" activity textview tv = new textview(c); // set text tv.settext(text); // set style tv.settextcolor(color.white); tv.settextsize(fontsize); tv.setsingleline(false); // add linear layout display.addview(tv); // add spacer view spacer = new view(c); // set bg color spacer.setbackgroundcolor(color.argb(0x88, 0, 0, 0)); // set width , height spacer.setlayoutparams(new linearlayout.layoutparams(linearlayout.layoutparams.match_parent, separatorheight)); // add layout display.addview(spacer); // screen should update displaychanged = true; } at end of loop have line: if (displaychanged) updatescreen(); and updatescreen() method: private vo...