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
you can implements Parcelable (easy with studio plugin), and then
public static T copy(T orig) {
Parcel p = Parcel.obtain();
orig.writeToParcel(p, 0);
p.setDataPosition(0);
T copy = null;
try {
copy = (T) orig.getClass().getDeclaredConstructor(new Class[]{Parcel.class}).newInstance(p);
} catch (Exception e) {
e.printStackTrace();
}
return copy;
}