作为Android Message IPC的一部分,通过Framelayout通过

发布于 2025-01-18 18:50:29 字数 709 浏览 1 评论 0原文

我已经实现了 Messenger 作为两个 Android 应用程序之间的 IPC 机制。现在我想传递一个 FrameLayout 对象作为 android.os.Message 的一部分,

Message msg = new Message();
Bundle bundle = new Bundle();
bundle.putString("4", "2");
msg.setData(bundle);
msg.what = 42;
msg.obj = a_frame_layout_instance;

我想这样做,以便 app1 可以创建一个布局并对其进行膨胀,然后通过 IPC 将布局对象传递给 app2,然后 app2 可以添加/更新看法。

这会失败,因为 FrameLayout 不可分割。

java.lang.RuntimeException: Can't marshal non-Parcelable objects across processes.
  1. 有没有办法通过IPC传递FrameLayout实例?
  2. 是否有其他路径可以探索,以便 app1 创建视图,app2 更新视图?

I have implemented a Messenger as IPC mechanism between two android apps. Now I want to pass a FrameLayout object as part of android.os.Message

Message msg = new Message();
Bundle bundle = new Bundle();
bundle.putString("4", "2");
msg.setData(bundle);
msg.what = 42;
msg.obj = a_frame_layout_instance;

I want to do this so that app1 can create a layout and inflate it, and then pass the layout object to app2 via IPC, which can then add/update the view.

This fails because FrameLayout is not parcelable.

java.lang.RuntimeException: Can't marshal non-Parcelable objects across processes.
  1. Is there a way to pass a FrameLayout instance via IPC?
  2. Is there some other path that can be explored so that app1 creates the views, and app2 updates the view?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文