![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Android
chenm91
这个作者很懒,什么都没留下…
展开
-
ProgressDialog和AsyncTask的使用
一般在安卓中为了方便子线程与主线程之间的交互,是通过主线程的Handler来实现的,即子线程用主线程的Handler来发送消息或post Callback,在主线程中就可以HandlerMessage或执行Callback。这种方式已经算很方便了,但是如果想加入一些附加的功能,比如子线程工作时显示一个进度条,子线程退出时,关闭进度条,就不太方便了。AsyncTask是安卓中为了方便子线程与U...原创 2019-06-14 12:47:48 · 187 阅读 · 0 评论 -
如何判断当前线程为主线程的方法
1、Looper.myLooper() == Looper.getMainLooper()2、Thread.currentThread() == Looper.getMainLooper().getThread()原创 2019-06-21 08:27:56 · 1714 阅读 · 0 评论