Handler修改子线程UI
给出了个小栗子 public class MainActivity extends AppCompatActivity implements View . OnClickListener { private TextView show; public static final int UPDATE_TEXT = 1 ; private Handler handler = new Handler() { @Override public void handleMessage (Message msg) { //接收,判断,处理消息 switch (msg.what) { case UPDATE_TEXT: show.setText( "更改UI" ); break ; default : break ; } } }; @Override protected void onCreate (Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView(R.layout.activity_main); //一个Textview,修改文字来达到模拟更改界面UI的效果 show = (TextView) findViewById(R.id.tv_show); } @Override public