private Handler handler=new Handler(){
@Override public void handleMessage(Message msg) {
private Handler handler=new Handler(){ @Override public void handleMessage(Message msg) {
strs.add(msg.obj.toString());
adapter.notifyDataSetChanged();
}
};
new Thread(){
@Override public void run() {
super.run();
try {
sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Message msg=new Message();
msg.obj="hello";
adapter.notifyDataSetChanged();
}
};
new Thread(){ @Override public void run() { super.run(); try { sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } Message msg=new Message(); msg.obj="hello";
handler.sendMessage(msg);
}
}.start();
} }.start();
private Handler handler=new Handler();
============================================================
handler.post(new Runnable() {
@Override
public void run() {
strs.add("handler post");
adapter.notifyDataSetChanged();
}
});
=======================================================================================
private Handler handler=new Handler();
============================================================
handler.post(new Runnable() { @Override
public void run() { strs.add("handler post"); adapter.notifyDataSetChanged(); } });
=======================================================================================
评论
发表评论