我正在使用 android 2.1 中的片段为此我使用 supportV4 jar。我在一个活动中有两个片段,一个用于新数据插入,另一个用于显示列表,我在片段中使用 ResourceCursorAdapter 来显示来自光标的所有数据,但是当我从这个活动移动到另一个活动时,我强制关闭它会产生这样的错误
07-23 18:26:13.028: E/AndroidRuntime(25309): java.lang.IllegalStateException: this should only be called when the cursor is valid
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.support.v4.widget.CursorAdapter.getView(CursorAdapter.java:245)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.AbsListView.obtainView(AbsListView.java:1315)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.ListView.measureHeightOfChildren(ListView.java:1198)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.ListView.onMeasure(ListView.java:1109)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.View.measure(View.java:8171)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.View.measure(View.java:8171)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.View.measure(View.java:8171)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1029)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.View.measure(View.java:8171)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.View.measure(View.java:8171)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.View.measure(View.java:8171)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.View.measure(View.java:8171)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.View.measure(View.java:8171)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.View.measure(View.java:8171)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.os.Handler.dispatchMessage(Handler.java:99)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.os.Looper.loop(Looper.java:123)
07-23 18:26:13.028: E/AndroidRuntime(25309): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-23 18:26:13.028: E/AndroidRuntime(25309): at java.lang.reflect.Method.invokeNative(Native Method)
07-23 18:26:13.028: E/AndroidRuntime(25309): at java.lang.reflect.Method.invoke(Method.java:521)
07-23 18:26:13.028: E/AndroidRuntime(25309): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-23 18:26:13.028: E/AndroidRuntime(25309): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-23 18:26:13.028: E/AndroidRuntime(25309): at dalvik.system.NativeStart.main(Native Method)