相关疑难解决方法(0)

编组通知包

我正在尝试将 Notification 对象写入文件。我能找到的最好方法是将对象写入包裹,编组该包裹以获取字节 [],然后将其写入文件。

Parcel notif = Parcel.obtain();
notification.writeToParcel(notif, 0);
byte[] notifArray = notif.marshall();
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试编组包裹时出现运行时异常:“试图编组包含 Binder 对象的包裹。”

有没有更好的方法将 Notification 对象写入文件?否则,我如何让这种方法发挥作用?

notifications android marshalling parcel

5
推荐指数
1
解决办法
1763
查看次数

标签 统计

android ×1

marshalling ×1

notifications ×1

parcel ×1