I'm setting a property on a realm object with another realm object which is a different class, however I'm getting the error: 'value' is not avalid managed object.
realmObject.setAnotherRealmObject(classInstance.returnAnotherRealmObjectWithValues())
The class instance receives anotherRealmObject constructor and returns it through the method with values from widgets:
public ClassInstance(AnotherRealmObject anotherRealmObject){
mAnotherRealmObject = anotherRealmObject;
}
public AnotherRealmObject returnAnotherRealmObjectWithValues(){
mAnotherRealmObject.setId(RandomUtil.randomNumbersAndLetters(5));
mAnotherRealmObject.setName(etName.getText().toString());
return mAnotherRealmObject;
}
I'm creating the new Another Realm Object the right way (I think):
mAnotherRealmObject = mRealmInstance.createObject(AnotherRealmObject.class);
Is it because I'm returning anotherRealmObject wherein it is already modified because of the passing reference?