vendredi 28 février 2020

Trying to get Value from Firebase database and creating if else statement to set value in firebase but app executes the fourth line only

This is my code.

finalteamcount.addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                    String one = "one";
                    String two = "two";
                    String three = "three";
                    String four = "four";
                    String qwq = dataSnapshot.getValue(String.class);
                    if (qwq == null){finalteamcount.setValue(one);}
                    if (qwq == one){finalteamcount.setValue(two);}
                    if (qwq == two){finalteamcount.setValue(three);}
                    if (qwq == three){finalteamcount.setValue(four);}

                }

It Directely set four, the value i am retriving is null

Aucun commentaire:

Enregistrer un commentaire