gpt4 book ai didi

android - 如何解决致命异常 : Timer-11 in android?

转载 作者:行者123 更新时间:2023-11-29 22:29:41 25 4
gpt4 key购买 nike

这里是异常代码::

if (getZoomLevel() != last_zoom)
{
// if computeScroll called before timer counts down we should drop it and start it over again
zoom_event_delay_timer.cancel();
zoom_event_delay_timer = new Timer();
Log.v("last_zoom","last_zoom");
zoom_event_delay_timer.schedule(new TimerTask()
{
@Override
public void run()
{
zoom_change_listener.onZoomChange(_this, getZoomLevel(), last_zoom);
Log.v("last_zoom","last_zoom"+last_zoom);
last_zoom = getZoomLevel();
Log.v("last_zoom","last_zoom");
}
}, events_timeout);
}

和错误:

01-05 12:24:50.791: ERROR/AndroidRuntime(11132): FATAL EXCEPTION: Timer-11
01-05 12:24:50.791: ERROR/AndroidRuntime(11132): java.util.ConcurrentModificationException
01-05 12:24:50.791: ERROR/AndroidRuntime(11132): at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573)
01-05 12:24:50.791: ERROR/AndroidRuntime(11132): at com.bluepal.android.parkable.Prakablescreen.onRegionChange(Prakablescreen.java:1028)
01-05 12:24:50.791: ERROR/AndroidRuntime(11132): at com.bluepal.android.parkable.Prakablescreen$14.onPanChange(Prakablescreen.java:467)
01-05 12:24:50.791: ERROR/AndroidRuntime(11132): at com.bluepal.android.parkable.EnhancedMapView$2.run(EnhancedMapView.java:126)
01-05 12:24:50.791: ERROR/AndroidRuntime(11132): at java.util.Timer$TimerImpl.run(Timer.java:289)

最佳答案

这里的问题似乎是您从另一个线程(在本例中为计时器)调用 UI 线程。我找到了 these sites用于解释和解决问题(我使用了处理程序)。

关于android - 如何解决致命异常 : Timer-11 in android?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4601605/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com