android.os.BadParcelableException: ClassNotFondException when unmarshalling

出现这个异常的原因是因为在调用Parcel类的诸如readList(List outVal, ClassLoader loader)的API时传入了错误的loader,这里容器里面放入的是什么类就需要使用什么loader,例如List<MyClass>,就需要传入MyClass.class.getClassLoader()

另外在自己的类实现Parcelable接口的时候,如果其中使用到了非基础类型MyClass,那么MyClass也是需要实现Parcelable接口的,否则会报出AndroidRuntime error: Parcel: unable to marshal value

参考:http://stackoverflow.com/questions/3818745/androidruntime-error-parcel-unable-to-marshal-value


你可能感兴趣的:(ClassLoader,list,api)