工作线程(后台线程)内操作UI线程(主线程)的方法汇集

示例: 

publicvoid onClick(View v){
    newThread(newRunnable(){
        publicvoid run(){
            Bitmap b = loadImageFromNetwork("http://example.com/image.png");
            mImageView.setImageBitmap(b);
        }
    }).start();
}

更多可参考http://developer.android.com/guide/components/processes-and-threads.htm

猜你喜欢

转载自zhegui.iteye.com/blog/1973951