作为Android Message IPC的一部分,通过Framelayout通过
我已经实现了 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.
- 有没有办法通过IPC传递FrameLayout实例?
- 是否有其他路径可以探索,以便 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.
- Is there a way to pass a FrameLayout instance via IPC?
- Is there some other path that can be explored so that app1 creates the views, and app2 updates the view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论