如何将结果从两个不同的API保存到一个房间数据库表?

发布于 2025-02-10 16:19:56 字数 73 浏览 1 评论 0原文

我想到了解决方案方法。 我可以使用Mergeadapter将数据显示在单个循环范围内,但是我可以使用两个不同的数据库表来执行此操作。

The solution method came to my mind.
I could display the data in a single recyclerview using MergeAdapter however I could do this with two different database tables.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

┼── 2025-02-17 16:19:56

使三个模型成为第一个API响应的第一个模型,第二个API响应的第二个模型是房间实体模型,并制作将第一个API模型和第二个API模型转换为房间实体模型的函数。现在,当您收到来自API的数据时,将其转换为房间型号并将其保存到房间数据库。

Make three models the first one for the first API response, the second one for the second API response and the third one is the room entity model, and make functions that convert the first API model and the second API model to the room entity model. Now when you receive the data from APIs convert it to room model and save it to room database.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文