我已将json文件导入到Firebase实时数据库中,您可以按照屏幕快照进行操作 https://ibb.co/wyLDPC8“数据库结构”
答案 0 :(得分:0)
您可以通过这种方式完成
DatabaseReference dbRef = FirebaseDatabase.getInstance().getReference();
dbRef.child("categories").addSingleValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
String name = snapshot.child("names").getValue().toString(); // it will give names node string
/// To Fetch Quotes
DataSnapshot quotesSnapshot = snapshot.child("qoutes");
for (DataSnapshot quoteSingleSnpashot : quotesSnapshot.getChildren()) {
String quote = quoteSingleSnpashot.child("quote").getValue().toString(); // it will give names node string
}
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}