Force close with View Swiping with ViewPager on An

2019-07-26 20:25发布

问题:

According to this post ViewPager is now compatible with Android 1.6 when compatible packages.

http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+blogspot%2FhsDu+%28Android+Developers+Blog%29

I tried out the example mentioned in the post, http://code.google.com/p/viewpagerexample/

I get force close when I try to run on Android 1.6 emulator.

Is it safe to use this package on Android1.6 ?

Logs here:

08-23 23:46:51.511: ERROR/AndroidRuntime(294): Uncaught handler: thread main exiting due to uncaught exception
08-23 23:46:51.531: ERROR/AndroidRuntime(294): java.lang.IndexOutOfBoundsException: Pre-Eclair does not support pointers
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.support.v4.view.MotionEventCompat$BaseMotionEventVersionImpl.getPointerId(MotionEventCompat.java:45)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.support.v4.view.MotionEventCompat.getPointerId(MotionEventCompat.java:160)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:784)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:801)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:820)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:820)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:820)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:820)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1712)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1202)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.app.Activity.dispatchTouchEvent(Activity.java:1987)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1696)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.os.Looper.loop(Looper.java:123)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at android.app.ActivityThread.main(ActivityThread.java:4203)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at java.lang.reflect.Method.invokeNative(Native Method)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at java.lang.reflect.Method.invoke(Method.java:521)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
08-23 23:46:51.531: ERROR/AndroidRuntime(294):     at dalvik.system.NativeStart.main(Native Method)

回答1:

see the comment 4 here. it seems to solve this problem... issue link