1、线程消息处理:
private Handler handler = new Handler(){ public void handleMessage(Message msg) { if (!Thread.currentThread().isInterrupted()) { switch (msg.what) { case 1: //break; case -1: //break; } } super.handleMessage(msg); } };
创建线程:
download(path,Environment.getExternalStorageDirectory());
.....
private void download(final String path,final File saveDir) { new Thread(new Runnable() { @Override public void run() { // } }).start(); } }