Mailing Shipment

I am trying to write a notification object to a file. The best way I could find was to write an object for sending, set the parcel to receive byte [], and then write it to a file.

Parcel notif = Parcel.obtain(); notification.writeToParcel(notif, 0); byte[] notifArray = notif.marshall(); 

I get a Runtime exception when I try to marshal the package: "I tried to assemble a parcel containing Binder objects."

Is there a better way to write Notification objects to a file? Else, how do I get this approach to work?

+4
source share
2 answers

The notification contains a live / active middleware object. It was not created to preserve state (in byte []), but it implements Parcelable for IPC purposes. You should ideally save the required fields, not the object itself.

+1
source

I think the best way is to save the information from the notification. The value of the Binder object cannot be saved because it will be changed.

0
source

All Articles