在FragmentStatePagerAdapter.instantiateItem()中解组未知类型代码XXX

时间:2018-04-02 14:10:55

标签: android unmarshalling parcel

最近,我在点击viewpager的标签时遇到了例外情况:

java.lang.RuntimeException: Parcel android.os.Parcel@39fa3a6f: Unmarshalling unknown type code 7471204 at offset 512
    at android.os.Parcel.readValue(Parcel.java:2228)
    at android.os.Parcel.readArrayMapInternal(Parcel.java:2485)
    at android.os.BaseBundle.unparcel(BaseBundle.java:221)
    at android.os.BaseBundle.putBoolean(BaseBundle.java:333)
    at android.support.v4.app.Fragment.setUserVisibleHint(Fragment.java:960)
    at android.support.v4.app.FragmentStatePagerAdapter.instantiateItem(FragmentStatePagerAdapter.java:121)
    at com.example.ui.base.TabPagerAdapter.instantiateItem(TabPagerAdapter.java:58)
    at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:1004)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1218)
    at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:663)
    at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:625)
    at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:606)
    at android.support.design.widget.TabLayout$ViewPagerOnTabSelectedListener.onTabSelected(TabLayout.java:2170)
    at android.support.design.widget.TabLayout.dispatchTabSelected(TabLayout.java:1165)
    at android.support.design.widget.TabLayout.selectTab(TabLayout.java:1158)
    at android.support.design.widget.TabLayout.selectTab(TabLayout.java:1128)
    at android.support.design.widget.TabLayout$Tab.select(TabLayout.java:1427)
    at android.support.design.widget.TabLayout$TabView.performClick(TabLayout.java:1537)
    at android.view.View$PerformClick.run(View.java:19866)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5254)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

应用程序有一个带有viewpager的片段,页面是在运行时实例化的片段。

方法TabPagerAdapter.instantiateItem():

public class TabPagerAdapter extends FragmentStatePagerAdapter {
    ...
    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        return super.instantiateItem(container, position);
    }
}

更多细节:compileSdkVersion 27,support-v4:27.1.0

0 个答案:

没有答案