【发布时间】:2014-05-14 10:32:29
【问题描述】:
对不起,标题,
我想通过一个意图传递一个自写类的数组。 这是发件人代码的样子:
private void publishResults(int result, DienstplanDatenreihe[] row, String action)
{
Intent intent = new Intent(NOTIFICATION);
intent.putExtra(WorkingCode.TABLE, row);
intent.putExtra(WorkingCode.RESULT, result);
intent.putExtra(ACTION,action);
sendBroadcast(intent);
}
这是接收方代码的样子:
Bundle extras = intent.getExtras();
DienstplanDatenreihe[] row = (DienstplanDatenreihe[]) extras.getSerializable(WorkingCode.TABLE);
这里有一个例外:
Caused by: java.lang.ClassCastException: java.lang.Object[] cannot be cast to HelperCode.DienstplanDatenreihe[]
而且我不知道为什么...互联网上的其他任何人都这样做。 [注意:我的 DienstplanDatenreihe 只包含字符串和字符串[]]
【问题讨论】:
标签: android android-intent classcastexception serializable