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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Make sure that your DataObj class implements Cloneable and add the following method
Then you should be able to call (DataObj)rlBodyDataObj.clone(); to get a clean copy (note the cast).