Java – Sort db4o Android on numeric fields

Sort db4o Android on numeric fields… here is a solution to the problem.

Sort db4o Android on numeric fields

I’m using a db4o database to store data in my Android application. I want to sort the objects in the Number field.

However, when I use query.descend("number").orderDescending(); , I got NullPointerException.

Why?

Solution

Finally solved the problem.

In fact, the problem is that the numbers are stored in a double-exponential format. Then I convert the number to long and the problem disappears :-).

Related Problems and Solutions