如何找出这个ConcurrentModificationException崩溃的位置?

时间:2011-12-24 12:09:22

标签: java android

我被ConcurrentModificationException困住了,我无法弄清楚我的代码中发生了什么。调试给我的所有内容都是:

myApp [Android Application] 
DalvikVM[localhost:8631]    
    Thread [<1> main] (Suspended (exception ConcurrentModificationException))   
        ViewRoot.draw(boolean) line: 1631   
        ViewRoot.performTraversals() line: 1329 
        ViewRoot.handleMessage(Message) line: 1944  
        ViewRoot(Handler).dispatchMessage(Message) line: 99 
        Looper.loop() line: 126 
        ActivityThread.main(String[]) line: 3997    
        Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
        Method.invoke(Object, Object...) line: 491  
        ZygoteInit$MethodAndArgsCaller.run() line: 841  
        ZygoteInit.main(String[]) line: 599 
        NativeStart.main(String[]) line: not available [native method]  
    Thread [<8> Binder Thread #2] (Running) 
    Thread [<7> Binder Thread #1] (Running) 
    Thread [<9> AsyncTask #1] (Running) 
    Thread [<10> AsyncTask #2] (Running)    
    Daemon Thread [<12> RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@40770068] (Running)  
    Thread [<11> AsyncTask #3] (Running)    

1 个答案:

答案 0 :(得分:0)

在迭代时修改集合时会出现

ConcurrentModificationException。此时,您可能更容易搜索正在更改集合的foreach循环。