アプリケーションの 2 つのアクティビティで PullToRefresh ライブラリを使用しています。このライブラリは非推奨ですが、非常に便利で、上からだけでなく下からの更新も処理できます。しかし、問題があります: このログでアプリケーションがクラッシュすることはめったにありません:
java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(16908298, class com.handmark.pulltorefresh.library.PullToRefreshListView$InternalListViewSDK9) with Adapter(class android.widget.HeaderViewListAdapter)]
at android.widget.ListView.layoutChildren(ListView.java:1551)
at android.widget.AbsListView.onTouchEvent(AbsListView.java:4218)
at android.view.View.dispatchTouchEvent(View.java:7461)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2264)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1995)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2182)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1512)
at android.app.Activity.dispatchTouchEvent(Activity.java:2466)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2130)
at android.view.View.dispatchPointerEvent(View.java:7641)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3682)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3613)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4804)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4783)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4875)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:174)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4854)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4894)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:530)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5328)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
このクラッシュはめったに発生しないため、デバイスを頻繁に使用する月に 1 回しか発生しません。しかし、Google Play デベロッパー コンソールのユーザーからのこのログにクラッシュ レポートが表示されます。
私が理解している限り、このクラッシュは私のコードではなく、InternalListViewSDK9 クラスの PullToRefresh ライブラリのコードで発生しています。InternalListViewSDK9 のコードは次のとおりです。
@TargetApi(9)
final class InternalListViewSDK9 extends InternalListView {
public InternalListViewSDK9(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX,
int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX,
scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
// Does all of the hard work...
OverscrollHelper.overScrollBy(PullToRefreshListView.this, deltaY, scrollY, isTouchEvent);
return returnValue;
}
}
再現できないことを考慮して、このバグを修正するにはどうすればよいですか? それを抑えることは可能でしょうか?