u012591487
下世纪神话
采纳率100%
2016-02-19 12:31 阅读 4.3k

用android viewPager出现的强转异常

用一个页面切换到另外一个页面出现了异常
02-19 19:56:32.645: E/GED(11205): Failed to get GED Log Buf, err(0)
02-19 19:56:37.141: E/AndroidRuntime(11205): FATAL EXCEPTION: main
02-19 19:56:37.141: E/AndroidRuntime(11205): Process: com.example.shuyannvshen, PID: 11205
02-19 19:56:37.141: E/AndroidRuntime(11205): java.lang.ClassCastException: com.viewpagerindicator.CirclePageIndicator$SavedState cannot be cast to android.widget.HorizontalScrollView$SavedState
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.widget.HorizontalScrollView.onRestoreInstanceState(HorizontalScrollView.java:1667)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.view.View.dispatchRestoreInstanceState(View.java:14030)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3018)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3024)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.view.View.restoreHierarchyState(View.java:14008)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.support.v4.app.Fragment.restoreViewState(Fragment.java:449)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:964)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1121)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1484)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:450)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.os.Handler.handleCallback(Handler.java:815)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.os.Handler.dispatchMessage(Handler.java:104)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.os.Looper.loop(Looper.java:194)
02-19 19:56:37.141: E/AndroidRuntime(11205): at android.app.ActivityThread.main(ActivityThread.java:5691)
02-19 19:56:37.141: E/AndroidRuntime(11205): at java.lang.reflect.Method.invoke(Native Method)
02-19 19:56:37.141: E/AndroidRuntime(11205): at java.lang.reflect.Method.invoke(Method.java:372)
02-19 19:56:37.141: E/AndroidRuntime(11205): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
02-19 19:56:37.141: E/AndroidRuntime(11205): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

3条回答 默认 最新

  • 已采纳
    devmiao devmiao 2016-02-19 14:10
  • liuguangsuiyue Eileng 2016-02-19 15:03

    java.lang.ClassCastException: com.viewpagerindicator.CirclePageIndicator$SavedState cannot be cast to android.widget.HorizontalScrollView

    是你在XML种布局的使用类型不一致吧, 仔细查看下。 强制转换必须是子类转父类才可以比如: List list = new ArrayList(); View v = findViewById(id); 或者是该类实现了同样的借口等

    点赞 1 评论 复制链接分享
  • luochoudan 丑旦 2016-02-19 14:25

    java.lang.ClassCastException: com.viewpagerindicator.CirclePageIndicator$SavedState cannot be cast to android.widget.HorizontalScrollView$SavedState,类型异常,从这往回找吧

    点赞 评论 复制链接分享

相关推荐