how to clone an object in android?
android, java
Solution
Make sure that your DataObj class implements Cloneable and add the following method
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
Then you should be able to call (DataObj)rlBodyDataObj.clone(); to get a clean copy (note the cast).
Problem
What would be the best way to copy/clone an object in java/android? ``` rlBodyDataObj rlbo = bdoTable.get(name); ``` Right now the code assigns an object from a hashTable, yet I need to get a clone of it, so that I'd be able to use it multiple times.