1
我的过程之前有这样的:序列化问题与SortedSet的,数组的序列化
protected void onPostExecute(SortedSet<RatedMessage> result) {
List<Object> list=Arrays.asList(result.toArray());
lancon.putExtra("results", list.toArray()); // as serializable
}
然后在另一部分我有
Object o=this.getIntent().getSerializableExtra("results");
//at this point the o holds the correct value (checked by debugger)
RatedMessage[] rm = (RatedMessage[]) o;// this line hangs out w ClassCastException
resultSet = new TreeSet<RatedMessage>(new Comp());
Collections.addAll(resultSet, rm);
为什么我得到的ClassCastException异常?
Thx,当所有其他失败时我成功应用此方法。 – hornetbzz 2012-08-31 16:04:57