新线程中创建Handler的方法

class LooperThread extends Thread {
public Handler mHandler;

public void run() {    
    Looper.prepare();    

    mHandler = new Handler() {    
        public void handleMessage(Message msg) {    
            // process incoming messages here    
        }    
    };    

    Looper.loop();    
}    

}

你可能感兴趣的:(Anroid优化小细节)