The problem occurs when your custom class has for property some other class e.g. "Bitmap". What I made is to change the property field from "private Bitmap photo" to "private transient Bitmap photo". However the image is empty after I getIntent() in the receiver activity. Because of this I passed the custom class to the intent and also I've created a byte array from the image and pass it separatly to the intent:
selectedItem is my custom object and getPlacePhoto is his method to get image. I've already set it before and now I just get it first than convert it and pass it separatly:
Bitmap image = selectedItem.getPlacePhoto();
image.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
Intent intent = new Intent(YourPresentActivity.this,
TheReceiverActivity.class);
intent.putExtra("selectedItem", selectedItem);
intent.putExtra("image", byteArray);
startActivity(intent);
`
Then in the receiver activity I get my object and the image as byte array, decode the image and set it to my object as photo property.
Intent intent = getIntent();
selectedItem = (ListItem) intent.getSerializableExtra("selectedItem");
byte[] byteArray = getIntent().getByteArrayExtra("image");
Bitmap image = BitmapFactory.decodeByteArray(byteArray, 0,
byteArray.length);
selectedItem.setPhoto(image);