How to solve this issue on Firebase admin panel?

自古美人都是妖i 提交于 2019-12-04 06:15:45

问题


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.

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?


回答1:


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().




回答2:


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



来源:https://stackoverflow.com/questions/45879932/how-to-solve-this-issue-on-firebase-admin-panel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!