Closed AndroidDeveloperLB closed 8 years ago
All model objects already implement Parcelable, so you should be good to go!
Note that if you are using our dev_3.0 branch, you will need to specify an option in the apt config in your build.gradle for this to be the case:
apt {
arguments {
squidbOptions 'androidModels'
}
}
If this is true, how come I don't see the generated model implement this interface, and also not any of the classes it extends/implements?
We use version 3. Is it because of this? but where do you put this code you've written?
Yes, if you are using version 3, you will need to add the apt configuration I mentioned to your build.gradle in order for the generated models to implement Parcelable. I think we've already determined that your gradle setup is different from ours :) so YMMV, but in our gradle files, this configuration just goes right below the dependencies.
OK, thank you for your quick help.
It seems to work great. What's the reason that on v3 we have to add the extra instructions to the gradle file, while for v2 we don't?
The main feature in v3 is support for iOS via Google's j2objc tool, which means that in v3 all dependencies on Android classes were removed from the core SquiDB module -- including Parcelable. In v2 models implemented Parcelable by default because the project was Android-only. The squidb-android addon module in v3 contains all the necessary support code for model objects to implement Parcelable when running on Android, and the gradle instructions simply activate that option in the code generator.
I see. Thank you. You are great.
Happy to help!
I tried adding this:
And the new entity did add its own :
But when I tried using it, I've found that all of the fields are null. Looking deeper, this seems to be because the fields data are in a map.
Is it possible to make the entities classes implement Serializable/Parcelable ?