Skip to content

Commit 59540f2

Browse files
Update README.md
1 parent 17320d7 commit 59540f2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public class App extends Application {
4343

4444
@Override
4545
public void handlerException(final Thread thread, final Throwable throwable) {
46+
//开发时使用Cockroach可能不容易发现bug,所以建议开发阶段在handlerException中用Toast谈个提示框,
47+
//由于handlerException可能运行在非ui线程中,Toast又需要在主线程,所以new了一个new Handler(Looper.getMainLooper()),
48+
//所以千万不要在下面的run方法中执行耗时操作,因为run已经运行在了ui线程中。
49+
//new Handler(Looper.getMainLooper())只是为了能弹出个toast,并无其他用途
4650
new Handler(Looper.getMainLooper()).post(new Runnable() {
4751
@Override
4852
public void run() {

0 commit comments

Comments
 (0)