Android笔记之线程使用

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(); } }

 

posted @ 2013-08-29 09:49  行云有影  阅读(160)  评论(0)    收藏  举报