我最近得到了一台 Xoom,我目前正在努力改进我的 HoneyComb 平板电脑应用程序。一切都很好,我的最后一个问题涉及一个带有 FastScroll 的 ListView 到 TabActavity。
this.setListAdapter(mIndexAdapter);
ListView lv = getListView();
lv.setTextFilterEnabled(true);
//lv.setFastScrollEnabled(true);
自 2 年以来,此代码在所有手机上都运行良好,但我现在遇到了 setFastScrollEnabled 问题!正如您在我的代码片段中看到的那样,我必须删除此行,否则会出现此异常(见下文)
任何想法是什么问题?我发现的唯一解决方法是:
if(android.os.Build.VERSION.SDK_INT<11)
lv.setFastScrollEnabled(true);
我可以发布我的适配器,但我真的不认为这是相关的。
06-13 13:24:50.520: INFO/ActivityManager(151): Starting: Intent { cmp=tof.cv.mpp/tof.cv.ui.BETrainsTabActivity } from pid 2327
06-13 13:24:50.620: DEBUG/dalvikvm(2327): GC_CONCURRENT freed 203K, 5% free 7383K/7751K, paused 2ms+3ms
06-13 13:24:50.700: DEBUG/AndroidRuntime(2327): Shutting down VM
06-13 13:24:50.700: WARN/dalvikvm(2327): threadid=1: thread exiting with uncaught exception (group=0x40110760)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): FATAL EXCEPTION: main
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): java.lang.NullPointerException
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.FastScroller.getThumbPositionForListPosition(FastScroller.java:612)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.FastScroller.onScroll(FastScroller.java:421)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1252)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.ListView.layoutChildren(ListView.java:1689)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.AbsListView.onLayout(AbsListView.java:1800)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.View.layout(View.java:9581)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewGroup.layout(ViewGroup.java:3877)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1542)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1403)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.LinearLayout.onLayout(LinearLayout.java:1314)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.View.layout(View.java:9581)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewGroup.layout(ViewGroup.java:3877)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.FrameLayout.onLayout(FrameLayout.java:400)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.View.layout(View.java:9581)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewGroup.layout(ViewGroup.java:3877)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1542)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1403)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.LinearLayout.onLayout(LinearLayout.java:1314)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.View.layout(View.java:9581)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewGroup.layout(ViewGroup.java:3877)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.FrameLayout.onLayout(FrameLayout.java:400)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.View.layout(View.java:9581)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewGroup.layout(ViewGroup.java:3877)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.FrameLayout.onLayout(FrameLayout.java:400)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.View.layout(View.java:9581)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewGroup.layout(ViewGroup.java:3877)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1542)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1403)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.LinearLayout.onLayout(LinearLayout.java:1314)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.View.layout(View.java:9581)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewGroup.layout(ViewGroup.java:3877)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.FrameLayout.onLayout(FrameLayout.java:400)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.View.layout(View.java:9581)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewGroup.layout(ViewGroup.java:3877)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.FrameLayout.onLayout(FrameLayout.java:400)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.View.layout(View.java:9581)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewGroup.layout(ViewGroup.java:3877)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1542)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1403)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.LinearLayout.onLayout(LinearLayout.java:1314)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.View.layout(View.java:9581)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewGroup.layout(ViewGroup.java:3877)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.widget.FrameLayout.onLayout(FrameLayout.java:400)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.View.layout(View.java:9581)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewGroup.layout(ViewGroup.java:3877)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewRoot.performTraversals(ViewRoot.java:1253)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.view.ViewRoot.handleMessage(ViewRoot.java:2003)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.os.Handler.dispatchMessage(Handler.java:99)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.os.Looper.loop(Looper.java:132)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at android.app.ActivityThread.main(ActivityThread.java:4025)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at java.lang.reflect.Method.invokeNative(Native Method)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at java.lang.reflect.Method.invoke(Method.java:491)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
06-13 13:24:50.700: ERROR/AndroidRuntime(2327): at dalvik.system.NativeStart.main(Native Method)
06-13 13:24:50.710: WARN/ActivityManager(151): Force finishing activity tof.cv.mpp/tof.cv.ui.BETrainsTabActivity