Android的序列化/对象传递和返回对象、序列化、Android

由网友(江山夢.)分享简介:所以,我有一个应用程序,管理工作订单。在该应用中的一个组成部分,我已检索从web服务工作订单的列表。用户然后拾取从列表中工作订单中的一个和列表开始一个新的活动(传递工作单对象的话),显示了工作单的详细信息。在此期间,用户可以编辑工作单的部分。如果用户返回到列表中(通过返回按钮),我需要通过返回到工作单列表,要么更新修改...

所以,我有一个应用程序,管理工作订单。在该应用中的一个组成部分,我已检索从web服务工作订单的列表。用户然后拾取从列表中工作订单中的一个和列表开始一个新的活动(传递工作单对象的话),显示了工作单的详细信息。在此期间,用户可以编辑工作单的部分。如果用户返回到列表中(通过返回按钮),我需要通过返回到工作单列表,要么更新修改工作单或替换为新修改的一个旧对象。否则,(如目前正在发生的事情),用户编辑的工作单,但如果他们回到列表并重新选择相同的工作单,工作单细节activty显示所有的旧数据。什么是做到这一点的最好办法。目前,我有工作单类实现Serializable所以工作单对象可以传递给后续活动。

So I have an app that manages workorders. In one part of the app, I have a list of workorders that has been retrieved from a web service. The user then picks one of the workorders from the list and the list starts a new activity (passing the Workorder object to it) that shows the workorder details. The user can edit parts of the workorder during this time. If the user returns to the list (via the back button), I need to pass the modified workorder BACK to the workorder list and either update or replace the old object with the new modified one. Otherwise, (as is currently happening) the user edits the workorder, but if they go back to the list and select the same workorder again, the workorder detail activty shows all the old data. What is the best way to do this. Currently I have the Workorder class implement Serializable so the workorder objects can be passed to successive activities.

所以这工作: 列表 - >工作单A

So this works: List -> Workorder A

但是,这是我遇到的问题: 名单< - 工作单A(修改)

But this is where I'm having the issue: List <- Workorder A (modified)

我不知道我是否应该使用startActivtyForResult并通过工作单对象返回与否。我知道这是有可能的,但我不知道是否有更优雅的方式来做到这一点。感谢您的任何和所有帮助,这是极大的AP preciated!

I'm not sure if I should be using startActivtyForResult and passing the workorder object back or not. I know it's a possibility, but I'm not sure if there are more graceful ways to do this. Thanks for any and all help as it is greatly appreciated!

推荐答案

如果您的工作单对象已序列化的,你可以很容易地在的

阅读全文

相关推荐

最新文章