关于Looper.loop()函数无法退出如何解决
我在一下代码中用到了Looper.loop();因为不调用Looper.prepare()无法toast;但是我调用了之后导致卡在Looper.loop()循环中,请问如何解决;呜呜呜,附上代码public void run() {if (Looper.myLooper() == null) {
Looper.prepare();
}
Log.d("toast", "toast");
Toast.makeText(getApplicationContext(), "Live ON!", Toast.LENGTH_LONG).show();
Log.d("toast", "toast");
Looper.loop();
Log.d("toast", "toast");
}
页:
[1]