简体   繁体   中英

Getting the list of child in firebase android

Check the Image of my firebase database

检查我的Firebase数据库的图像

Please click first the link to see the image. How can I get the KjfLmUnPUaWeYDETp04 and PlamHmUnPUaWeYDETp04 and insert it in the List<String> in android. Thank you in advance.

  mFirebaseInstance.getReference("users").addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {

                }

                @Override
                public void onCancelled(DatabaseError error) {

                }
            });
mFirebaseInstance.getReference("users").addValueEventListener(new 
ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
              for(DataSnapshot dst : dataSnapshot.getChildren()){
               //Key stores KjfLmUnPUaWeYDETp04 and PlamHmUnPUaWeYDETp04
                String key = dst.getKey();

              }
            }

            @Override
            public void onCancelled(DatabaseError error) {

            }
        });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM