2

私はアプリケーションを開発しており、チャートエンジンを使用して、テストする乱数であるデータを示すチャートを描画しています。期待どおりに動作しますが、数秒実行するとクラッシュし、run() スレッドをスリープ状態にしようとするとクラッシュするようになります。それは LogCat です。

04-22 18:22:02.253: I/(1902): run() -> LogicAnalizerView
04-22 18:22:02.262: I/(1902): run() -> LogicAnalizerView - input.add(5.1999974),factor[n]
04-22 18:22:02.271: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:02.271: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:02.781: I/(1902): run() -> LogicAnalizerView
04-22 18:22:02.781: I/(1902): run() -> LogicAnalizerView - input.add(5.2999973),factor[n]
04-22 18:22:02.802: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:02.802: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:03.182: D/dalvikvm(1902): GC_CONCURRENT freed 445K, 6% free 9330K/9863K, paused 42ms+33ms
04-22 18:22:03.522: I/(1902): run() -> LogicAnalizerView
04-22 18:22:03.522: I/(1902): run() -> LogicAnalizerView - input.add(5.399997),factor[n]
04-22 18:22:03.522: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:03.522: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:04.052: I/(1902): run() -> LogicAnalizerView
04-22 18:22:04.052: I/(1902): run() -> LogicAnalizerView - input.add(5.499997),factor[n]
04-22 18:22:04.084: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:04.084: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:04.607: I/(1902): run() -> LogicAnalizerView
04-22 18:22:04.612: I/(1902): run() -> LogicAnalizerView - input.add(5.599997),factor[n]
04-22 18:22:04.622: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:04.632: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:05.131: I/(1902): run() -> LogicAnalizerView
04-22 18:22:05.131: I/(1902): run() -> LogicAnalizerView - input.add(5.699997),factor[n]
04-22 18:22:05.163: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:05.163: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:05.687: I/(1902): run() -> LogicAnalizerView
04-22 18:22:05.687: I/(1902): run() -> LogicAnalizerView - input.add(5.799997),factor[n]
04-22 18:22:05.691: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:05.691: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:06.302: I/(1902): run() -> LogicAnalizerView
04-22 18:22:06.302: I/(1902): run() -> LogicAnalizerView - input.add(5.8999968),factor[n]
04-22 18:22:06.351: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:06.351: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:06.962: I/(1902): run() -> LogicAnalizerView
04-22 18:22:06.962: I/(1902): run() -> LogicAnalizerView - input.add(5.9999967),factor[n]
04-22 18:22:06.962: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:06.991: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:07.491: I/(1902): run() -> LogicAnalizerView
04-22 18:22:07.491: I/(1902): run() -> LogicAnalizerView - input.add(6.0999966),factor[n]
04-22 18:22:07.521: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:07.521: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:07.933: D/dalvikvm(1902): GC_CONCURRENT freed 436K, 6% free 9334K/9863K, paused 12ms+62ms
04-22 18:22:08.061: I/(1902): run() -> LogicAnalizerView
04-22 18:22:08.061: I/(1902): run() -> LogicAnalizerView - input.add(6.1999965),factor[n]
04-22 18:22:08.061: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:08.061: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:08.133: D/AndroidRuntime(1902): Shutting down VM
04-22 18:22:08.133: W/dalvikvm(1902): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
04-22 18:22:08.481: E/AndroidRuntime(1902): FATAL EXCEPTION: main
04-22 18:22:08.481: E/AndroidRuntime(1902): java.util.ConcurrentModificationException
04-22 18:22:08.481: E/AndroidRuntime(1902):     at java.util.TreeMap$MapIterator.stepForward(TreeMap.java:883)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at java.util.TreeMap$BoundedMap$BoundedIterator.stepForward(TreeMap.java:1484)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at java.util.TreeMap$BoundedMap$BoundedEntrySet$1.next(TreeMap.java:1512)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at java.util.TreeMap$BoundedMap$BoundedEntrySet$1.next(TreeMap.java:1510)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at org.achartengine.chart.XYChart.draw(XYChart.java:250)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at org.achartengine.GraphicalView.onDraw(GraphicalView.java:166)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.view.View.draw(View.java:10978)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.view.ViewGroup.drawChild(ViewGroup.java:2887)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.view.View.draw(View.java:10981)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.widget.FrameLayout.draw(FrameLayout.java:450)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2126)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.view.ViewRootImpl.draw(ViewRootImpl.java:2026)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1634)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.os.Looper.loop(Looper.java:137)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at android.app.ActivityThread.main(ActivityThread.java:4424)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at java.lang.reflect.Method.invokeNative(Native Method)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at java.lang.reflect.Method.invoke(Method.java:511)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-22 18:22:08.481: E/AndroidRuntime(1902):     at dalvik.system.NativeStart.main(Native Method)
04-22 18:22:08.561: I/(1902): run() -> LogicAnalizerView
04-22 18:22:08.561: I/(1902): run() -> LogicAnalizerView - input.add(6.2999964),factor[n]
04-22 18:22:08.581: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:08.581: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:09.112: I/(1902): run() -> LogicAnalizerView
04-22 18:22:09.112: I/(1902): run() -> LogicAnalizerView - input.add(6.3999963),factor[n]
04-22 18:22:09.131: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:09.131: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:09.495: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:09.671: I/(1902): run() -> LogicAnalizerView
04-22 18:22:09.681: I/(1902): run() -> LogicAnalizerView - input.add(6.499996),factor[n]
04-22 18:22:09.691: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:09.701: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:09.731: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:10.231: I/(1902): run() -> LogicAnalizerView
04-22 18:22:10.231: I/(1902): run() -> LogicAnalizerView - input.add(6.599996),factor[n]
04-22 18:22:10.251: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:10.251: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:10.572: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:11.101: I/(1902): run() -> LogicAnalizerView
04-22 18:22:11.101: I/(1902): run() -> LogicAnalizerView - input.add(6.699996),factor[n]
04-22 18:22:11.101: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:11.101: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:11.155: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:11.615: I/(1902): run() -> LogicAnalizerView
04-22 18:22:11.615: I/(1902): run() -> LogicAnalizerView - input.add(6.799996),factor[n]
04-22 18:22:11.641: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:11.641: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:12.182: I/(1902): run() -> LogicAnalizerView
04-22 18:22:12.182: I/(1902): run() -> LogicAnalizerView - input.add(6.899996),factor[n]
04-22 18:22:12.213: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:12.213: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:12.381: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:12.581: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:12.762: I/(1902): run() -> LogicAnalizerView
04-22 18:22:12.762: I/(1902): run() -> LogicAnalizerView - input.add(6.9999957),factor[n]
04-22 18:22:12.821: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:12.821: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:13.134: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:13.351: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:13.361: I/(1902): run() -> LogicAnalizerView
04-22 18:22:13.361: I/(1902): run() -> LogicAnalizerView - input.add(7.0999956),factor[n]
04-22 18:22:13.361: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:13.361: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:13.491: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:13.551: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:13.873: I/(1902): run() -> LogicAnalizerView
04-22 18:22:13.873: I/(1902): run() -> LogicAnalizerView - input.add(7.1999955),factor[n]
04-22 18:22:13.873: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:13.873: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:14.001: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:14.073: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:14.422: I/(1902): run() -> LogicAnalizerView
04-22 18:22:14.422: I/(1902): run() -> LogicAnalizerView - input.add(7.2999954),factor[n]
04-22 18:22:14.422: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:14.422: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:14.541: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:14.621: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:14.921: I/(1902): run() -> LogicAnalizerView
04-22 18:22:14.933: I/(1902): run() -> LogicAnalizerView - input.add(7.3999953),factor[n]
04-22 18:22:14.953: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:14.953: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:15.151: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:15.401: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:15.461: I/(1902): run() -> LogicAnalizerView
04-22 18:22:15.461: I/(1902): run() -> LogicAnalizerView - input.add(7.499995),factor[n]
04-22 18:22:15.461: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:15.474: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:15.601: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:15.661: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:16.028: I/(1902): run() -> LogicAnalizerView
04-22 18:22:16.028: I/(1902): run() -> LogicAnalizerView - input.add(7.599995),factor[n]
04-22 18:22:16.031: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:16.031: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:16.171: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:16.241: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:16.591: I/(1902): run() -> LogicAnalizerView
04-22 18:22:16.591: I/(1902): run() -> LogicAnalizerView - input.add(7.699995),factor[n]
04-22 18:22:16.621: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:16.621: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:16.731: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:16.791: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:17.145: I/(1902): run() -> LogicAnalizerView
04-22 18:22:17.145: I/(1902): run() -> LogicAnalizerView - input.add(7.799995),factor[n]
04-22 18:22:17.145: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:17.145: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:17.271: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:17.331: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:17.684: I/(1902): run() -> LogicAnalizerView
04-22 18:22:17.684: I/(1902): run() -> LogicAnalizerView - input.add(7.899995),factor[n]
04-22 18:22:17.704: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:17.711: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:17.831: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:17.902: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:18.221: I/(1902): run() -> LogicAnalizerView
04-22 18:22:18.231: I/(1902): run() -> LogicAnalizerView - input.add(7.9999948),factor[n]
04-22 18:22:18.243: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:18.243: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:18.364: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:18.442: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:18.795: I/(1902): run() -> LogicAnalizerView
04-22 18:22:18.795: I/(1902): run() -> LogicAnalizerView - input.add(8.099995),factor[n]
04-22 18:22:18.802: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:18.815: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:18.932: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:18.991: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:19.371: I/(1902): run() -> LogicAnalizerView
04-22 18:22:19.371: I/(1902): run() -> LogicAnalizerView - input.add(8.199995),factor[n]
04-22 18:22:19.392: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:19.392: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:19.441: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:19.522: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:19.952: I/(1902): run() -> LogicAnalizerView
04-22 18:22:19.952: I/(1902): run() -> LogicAnalizerView - input.add(8.299995),factor[n]
04-22 18:22:19.952: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:19.952: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:20.002: I/dalvikvm(1902): threadid=3: reacting to signal 3
04-22 18:22:20.074: I/dalvikvm(1902): Wrote stack traces to '/data/anr/traces.txt'
04-22 18:22:20.513: I/(1902): run() -> LogicAnalizerView
04-22 18:22:20.513: I/(1902): run() -> LogicAnalizerView - input.add(8.399996),factor[n]
04-22 18:22:20.534: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:20.534: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:21.066: I/(1902): run() -> LogicAnalizerView
04-22 18:22:21.092: I/(1902): run() -> LogicAnalizerView - input.add(8.499996),factor[n]
04-22 18:22:21.102: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:21.112: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:21.623: I/(1902): run() -> LogicAnalizerView
04-22 18:22:21.623: I/(1902): run() -> LogicAnalizerView - input.add(8.599997),factor[n]
04-22 18:22:21.623: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:21.623: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:22.152: I/(1902): run() -> LogicAnalizerView
04-22 18:22:22.161: I/(1902): run() -> LogicAnalizerView - input.add(8.699997),factor[n]
04-22 18:22:22.173: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:22.182: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:22.711: I/(1902): run() -> LogicAnalizerView
04-22 18:22:22.761: I/(1902): run() -> LogicAnalizerView - input.add(8.799997),factor[n]
04-22 18:22:22.761: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:22.761: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:23.295: I/(1902): run() -> LogicAnalizerView
04-22 18:22:23.295: I/(1902): run() -> LogicAnalizerView - input.add(8.899998),factor[n]
04-22 18:22:23.314: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:23.314: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:23.884: I/(1902): run() -> LogicAnalizerView
04-22 18:22:23.884: I/(1902): run() -> LogicAnalizerView - input.add(8.999998),factor[n]
04-22 18:22:23.884: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:23.884: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:24.383: I/(1902): run() -> LogicAnalizerView
04-22 18:22:24.391: I/(1902): run() -> LogicAnalizerView - input.add(9.099998),factor[n]
04-22 18:22:24.391: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:24.391: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:24.901: I/(1902): run() -> LogicAnalizerView
04-22 18:22:24.901: I/(1902): run() -> LogicAnalizerView - input.add(9.199999),factor[n]
04-22 18:22:24.911: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:24.911: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:25.466: I/(1902): run() -> LogicAnalizerView
04-22 18:22:25.491: I/(1902): run() -> LogicAnalizerView - input.add(9.299999),factor[n]
04-22 18:22:25.511: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:25.511: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:26.045: I/(1902): run() -> LogicAnalizerView
04-22 18:22:26.045: I/(1902): run() -> LogicAnalizerView - input.add(9.4),factor[n]
04-22 18:22:26.071: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:26.071: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:26.592: I/(1902): run() -> LogicAnalizerView
04-22 18:22:26.601: I/(1902): run() -> LogicAnalizerView - input.add(9.5),factor[n]
04-22 18:22:26.613: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:26.613: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:27.133: I/(1902): run() -> LogicAnalizerView
04-22 18:22:27.133: I/(1902): run() -> LogicAnalizerView - input.add(9.6),factor[n]
04-22 18:22:27.141: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:27.161: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:27.682: I/(1902): run() -> LogicAnalizerView
04-22 18:22:27.682: I/(1902): run() -> LogicAnalizerView - input.add(9.700001),factor[n]
04-22 18:22:27.691: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:27.691: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:28.217: I/(1902): run() -> LogicAnalizerView
04-22 18:22:28.217: I/(1902): run() -> LogicAnalizerView - input.add(9.800001),factor[n]
04-22 18:22:28.221: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:28.231: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:28.779: I/(1902): run() -> LogicAnalizerView
04-22 18:22:28.781: I/(1902): run() -> LogicAnalizerView - input.add(9.900002),factor[n]
04-22 18:22:28.791: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:28.801: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:29.320: I/(1902): run() -> LogicAnalizerView
04-22 18:22:29.321: I/(1902): run() -> LogicAnalizerView - input.add(10.000002),factor[n]
04-22 18:22:29.321: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:29.331: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:29.882: I/(1902): run() -> LogicAnalizerView
04-22 18:22:29.882: I/(1902): run() -> LogicAnalizerView - input.add(10.100002),factor[n]
04-22 18:22:29.882: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:29.882: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:30.410: I/(1902): run() -> LogicAnalizerView
04-22 18:22:30.411: I/(1902): run() -> LogicAnalizerView - input.add(10.200003),factor[n]
04-22 18:22:30.411: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:30.411: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:30.931: I/(1902): run() -> LogicAnalizerView
04-22 18:22:30.931: I/(1902): run() -> LogicAnalizerView - input.add(10.300003),factor[n]
04-22 18:22:30.931: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:30.931: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:31.464: I/(1902): run() -> LogicAnalizerView
04-22 18:22:31.464: I/(1902): run() -> LogicAnalizerView - input.add(10.400003),factor[n]
04-22 18:22:31.464: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:31.464: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:32.020: I/(1902): run() -> LogicAnalizerView
04-22 18:22:32.021: I/(1902): run() -> LogicAnalizerView - input.add(10.500004),factor[n]
04-22 18:22:32.021: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:32.021: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:32.570: I/(1902): run() -> LogicAnalizerView
04-22 18:22:32.570: I/(1902): run() -> LogicAnalizerView - input.add(10.600004),factor[n]
04-22 18:22:32.570: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:32.570: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:33.094: I/(1902): run() -> LogicAnalizerView
04-22 18:22:33.094: I/(1902): run() -> LogicAnalizerView - input.add(10.700005),factor[n]
04-22 18:22:33.094: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:33.094: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:33.636: I/(1902): run() -> LogicAnalizerView
04-22 18:22:33.636: I/(1902): run() -> LogicAnalizerView - input.add(10.800005),factor[n]
04-22 18:22:33.636: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:33.661: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:34.192: I/(1902): run() -> LogicAnalizerView
04-22 18:22:34.192: I/(1902): run() -> LogicAnalizerView - input.add(10.900005),factor[n]
04-22 18:22:34.192: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:34.192: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:34.743: I/(1902): run() -> LogicAnalizerView
04-22 18:22:34.743: I/(1902): run() -> LogicAnalizerView - input.add(11.000006),factor[n]
04-22 18:22:34.743: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:34.743: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:35.271: I/(1902): run() -> LogicAnalizerView
04-22 18:22:35.271: I/(1902): run() -> LogicAnalizerView - input.add(11.100006),factor[n]
04-22 18:22:35.271: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:35.271: I/(1902): run() -> LogicAnalizerView - Thread.sleep()
04-22 18:22:35.803: I/(1902): run() -> LogicAnalizerView
04-22 18:22:35.803: I/(1902): run() -> LogicAnalizerView - input.add(11.2000065),factor[n]
04-22 18:22:35.811: I/(1902): run() -> LogicAnalizerView - mView.repaint()
04-22 18:22:35.811: I/(1902): run() -> LogicAnalizerView - Thread.sleep()

私が見る限り、問題は ConcurrentModificationException にあると思います。調査しましたが、確かに理解できません:/。

http://developer.android.com/reference/java/util/ConcurrentModificationException.html http://developer.android.com/reference/java/util/Collection.html

これは、チャートが再描画されている私の Java コードの一部です。

    //onResume() se llama al resumir la Activity y tambien al crearse la Activity
    @Override
    protected void onResume() {
        super.onResume();
        actionBar.setSelectedNavigationItem(2);     //seleccion el item 0 (LC)
        //Creo el Thread y lo inicio
        Running = true;
        myThread = new Thread(this);
        myThread.start();
    }

    //onPause() se llama cuando se pausa la Activity y tambien antes de su destruccion
    @Override
    protected void onPause() {
        super.onPause();
        //destruyo el Thread
        Running = false;
        try {
            myThread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        myThread = null;    //pongo el Thread como null para no provocar errores
    }

    @Override
    public void run() {

        while(Running){

            int[] factor = {0, 2, 4, 6}; 

            if(DEBUG) Log.i(TAG, "run() -> LogicAnalizerView");

            data = USBMulti.getLogicAnalizerData();
            for(int n = 0; n < 4; ++n){
                if(bitTest(data,n)) factor[n] += 1;
            }

            if(DEBUG) Log.i(TAG, "run() -> LogicAnalizerView - input.add(" + time + "),factor[n]");
            input1.add(time,factor[0]);
            input2.add(time,factor[1]);
            input3.add(time,factor[2]);
            input4.add(time,factor[3]);

            if(DEBUG) Log.i(TAG, "run() -> LogicAnalizerView - mView.repaint()");
            mView.repaint();    // Redibujo el grafico
            time += 0.1;

            if(DEBUG) Log.i(TAG, "run() -> LogicAnalizerView - Thread.sleep()");

            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }

    }

ありがとうございます :)

4

2 に答える 2

1

わかりました私は解決策を見つけました。問題は、UI スレッドではないスレッドで UI を更新しているため、以下のようにハンドラーを使用し、UI を変更するコードをハンドラーに配置する必要があることです。run() メソッドからハンドラーを呼び出します。

uiCallback.sendEmptyMessage(0);

ハンドラーは uiCallback と呼ばれ、次の方法でハンドラーを定義します。

private Handler uiCallback = new Handler () {
    public void handleMessage (Message msg) {
        if (DEBUG) Log.i(TAG, "run() -> Handler");
        int[] factor = {0, 2, 4, 6};

        data = USBMulti.getLogicAnalizerData();
        for(int n = 0; n < 4; ++n) {
            if(bitTest(data,n)) factor[n] += 1;
        }

        input1.add(time,factor[0]);
        input2.add(time,factor[1]);
        input3.add(time,factor[2]);
        input4.add(time,factor[3]);

        if (DEBUG) Log.i(TAG, "run() -> LogicAnalizerView - mView.repaint()");
        if (mView != null) {
            mView.repaint(); // Redibujo el grafico
        }
        time += 0.1;
    }
};

だから私はUIスレッドでチャートを再描画し、それは完全に機能します:)。

ありがとうございます :)

于 2012-04-25T02:06:03.610 に答える
0

achartengineが同じデータセットを反復処理しているの.addと同時に、データセットを呼び出しているように見えます。

再描画がどのように機能するかは 100% わかりませんが、別のスレッドで起動する場合は、変更中にデータセットを読み取らないように同期する方法が必要になる場合があります。

正確な方法はわかりませんが、これが正しい方向に向けられることを願っています。

于 2012-04-22T18:59:35.803 に答える