Android Intent传递 List

看过其他人写的这个intent 传递List的方法,内容是putExtras(key, (Serializable)list)方法传递过去,接受的时候用(List<YourObject>) getIntent().getSerializable(key)。

但我写putExtras这个方法出错,原因是参数不对。那我将就写成 intent.putExtra("list",(Serializable)list);然后在接收的Activity里写

 list =(ArrayList<ClassInfo>)intent.getSerializableExtra("list"); 这方法是我无意中发出的。注意一点 ClassInfo这个是我自定义的类。要实现Serializable接口。

原文地址:https://www.cnblogs.com/andgoo/p/2705259.html