Reputation: 1
Sorry for the title,
I want to pass an Array of an selfwritten class through an intent. This is what the Sender Code looks like:
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);
}
This is what the receiver code looks like:
Bundle extras = intent.getExtras();
DienstplanDatenreihe[] row = (DienstplanDatenreihe[]) extras.getSerializable(WorkingCode.TABLE);
And here comes the exception:
Caused by: java.lang.ClassCastException: java.lang.Object[] cannot be cast to HelperCode.DienstplanDatenreihe[]
And i dont know why... anyone else on the internet does it this way. [Note: My DienstplanDatenreihe contains only Strings and a String[] ]
Upvotes: 0
Views: 44
Reputation: 13223
DienstplanDatenreihe
is probably a custom class that does not implement Parcelable
and hence Android cannot pass it via an Intent
by default. You will have to make your class implement the Parcelable
interface.
Upvotes: 1