How to solve this issue on Firebase admin panel?

194 Views Asked by At

I'm trying to integrate firebase on Android project. Everything works well, but I could see the customized class members was sorted in alphabetically rather than defined order when I visit Firebase Admin.

Here is customized class on Android code:


@IgnoreExtraProperties
public class trackingData 
{
    public String Time;

    public double S1 = 0.0;
    public double S2 = 0.0;
    public double S3 = 0.0;
    public double S4 = 0.0;

    public double copX;
    public double copY;
    public double copD;

    public double VelocityX;
    public double VelocityY;
    public double VelocityD;

    public int copScore;
    public int stabilityScore;

    public fbTrackingData() {
        Time = "20000";
        S1 = 2.35;
        S2 = 3.55;
        S3 = 0;
        S4 = 0;
        copX = 0;
        copY = 0;
        VelocityX = 10.3;
        VelocityY = 10.5;
        VelocityD = 20.3;
        copScore = 10;
        stabilityScore = 5;
    }
}

And Here is screenshot on Firebase console.

Firebase admin screenshot

I want to see all the class members as defined order like "Time", "S1", "S2", "S3", "S4", "CopX", "CopY", "CopD", ... , "copScore", "stabilityScore".

How can I solve it on either of Android or Firebase console?

2

There are 2 best solutions below

0
On

actully you don't order firebase admin panel in your desired way its permanently order in alphabtic by firebase team.

0
On

You cannot order those children in the Firebase console. There is no way for achieving this. What can you do instead, is to display those children according to your needs. So for that I recommend you using orderByChild() method. There are also 2 more methods, orderByKey() and orderByValue().