jjzjj

myLooper

全部标签

android - looper 到 "quit"哪里?

我的循环器有问题。我调用了looper.prepare(),在做了一些事情后一切正常。但是,如果我旋转设备,我会在准备时遇到异常。07-1216:40:09.760:E/activity(15809):java.lang.RuntimeException:OnlyoneLoopermaybecreatedperthread我正在尝试退出循环程序,但它什么也没做。这是我的异步任务:@OverrideprotectedStringdoInBackground(String...args){try{Looper.prepare();//herestarttheexceptiontry{URL

android - android.os.Looper 中的方法 myLooper 未使用协程模拟

我想在JUnit中对协程进行一些测试,但我遇到了一些问题。代码很简单:@TestfuncoroutineTest(){//runBlocking(Unconfined)doesntworktoorunBlocking(){delay(1000)println("test")}}但是我得到了那个错误java.lang.RuntimeException:MethodmyLooperinandroid.os.Loopernotmocked.Seehttp://g.co/androidstudio/not-mockedfordetails.atandroid.os.Looper.myLoope