2011-06-13 98 views
1

我最近得到了一個Xoom,我目前正致力於改進我的HoneyComb平板電腦的應用程序。 一切都很好,我最後一個問題涉及到一個帶FastScroll的ListView到TabActavity。setFastScrollEnabled在Honeycomb平板電腦上適用於我所有的手機和崩潰

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 

回答

1

我見過的錯誤報道多次在Android 3.1以及3.0.1(在FastScroller.java:609) 東西,具有快速滾輪工作之前是不會了。

2

我看到這個,如果我從getSections()方法返回null。改變它返回一個空數組,而不是工作(新的字符串[0])。但是,快速滾動在這種情況下不起作用,就像它在手機上一樣。

相關問題