当前位置:编程学习 > wap >>

android IPC进程间通信,传递非基本数据类型报错:Class not found when unmarshalling:类找不到。

Class not found when unmarshalling: com.jsecode.idcardreader.entity.IdCardInfo, e: java.lang.ClassNotFoundException: 

Remote代码:

Message val = Message.obtain(null, SCAN);
IdCardInfo card = new IdCardInfo();//实现Parcelable接口
card.setmPersonName("网麻醉");
                        
Bundle b = new Bundle();
b.putParcelable(DATA, card);
                        
val.setData(b);
                        
msg.replyTo.send(val);


Client代码:

Bundle b = msg.getData();
b.setClassLoader(IdCardInfo.class.getClassLoader());
IdCardInfo info = (IdCardInfo)b.getParcelable(DATA);


在Service中传递对象IdCardInfo给客户端时,客户端报Class not found when unmarshalling: com.jsecode.idcardreader.entity.IdCardInfo, e: java.lang.ClassNotFoundException错误,请各位帮助。(这是在两个进程间,两个项目中有相同的IdCardInfo类,这两个类的包路径不同) Android ipc Messager通信 Bundle.setData 类找不到 --------------------编程问答-------------------- 把服务端的这个类的代码拷贝一份到客户端程序 --------------------编程问答-------------------- 如果要传递自定义类的话,建议用AIDL  可详见http://blog.csdn.net/chenzujie/article/details/7791968
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,