我已经看到针对 sqlite 和 C# 发布的类似问题。
但不适用于java。如何将现有的 TableRow 复制到新的 TableRow 中?
我不想分享任何参考,我希望这两个小部件是相同的。
难道是java缺少这个基本的对象复制功能吗?
我认为 TableRows 不可克隆,因为当我尝试编写时 Eclipse 没有自动完成row.clone()
手动复制不是一种选择,因为 TableRow 有很多字段。
注意:标题中的“小部件”是为了使其更通用以供将来搜索
tableRow inherits from java.object however clone is not visible. This should be posible using brute force. A couple of options come to mind here. One and probably the hardest but best method would be to implement the clonable interface in a sub class.
The other way would be to iterate through the children and deep copy them to a new table row.
Either way I dont envey what you have ahead of you.