【发布时间】:2018-08-27 10:13:41
【问题描述】:
我正在尝试通过Intent 将top50TrendsList 传递给另一个活动,如下代码所示,但它被标记为红色,并且我收到一条错误消息:
2nd parameter cant be cast to Serializable
尽管Trend 类实现了Serializable 接口。
请告诉我如何通过Intent 将top50TrendsList 传递给另一个活动?谢谢。
代码:
List<Trend> top50TrendsList = this.mTrendsList.subList(0, 2);
Collections.sort(this.mTrendsList);
Intent intentSendBroadcast = new Intent();
intentSendBroadcast.setAction(ActMain.CONST_BROADCAST_ACTION_ON_LIST_READY);
Bundle b = new Bundle();
b.putSerializable(TwitterTrendsAPIService.CONST_BUNDLE_KEY_SERIALIZED_LIST, top50TrendsList);
intentSendBroadcast.putExtras(b);
sendBroadcast(intentSendBroadcast);
【问题讨论】:
标签: android list android-intent sublist