Don’t implement equal function in Sugar Object
Sugar ORM helps work with Android Databases easy way. We implemented almost all feature in our app. During beta test, we start using lots of data presenting on UI, but found out that each time we list the data, the number of data count are not same all the time. Maybe this time we got 5 data records, next time we got 6 data records, although we know exactly have 8 data totally in database.
We look through stackoverflow but couldn’t find any develop have the same issue like this one. At the end almost want to drop this library and change to another one, found out, wait… we implement the equal function in that object for compare use. Then we remove it as pure clean as it can like the Sugar ORM document said, finally… our problem has been solved.
Don’t implement or overwrite the equal method in SugarObject, try other way to compare the SugarObject. And thank god we saved the library back and continuous to move on.