📜  什么是 android studio 中的 datasnapshot.getkey() - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:36.099000             🧑  作者: Mango

代码示例1
Query reference=FirebaseDatabase.getInstance().getReference().child("products").orderByChild("name").equalTo("iphon");
reference.addListenerForSingleValueEvent(new ValueEventListener() {
    @Override
    public void onDataChange(DataSnapshot dataSnapshot) {
        for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) {
            String key=childSnapshot.getKey();
            Log.i(TAG,key);
        }
    }