我在数据库中有数据的同时获取datasnapshot值null

时间:2018-04-07 06:43:15

标签: android

我想从给定的引用中访问章节名称。

databaseReferenceGetChapter = FirebaseDatabase.getInstance().getReference(mAuth.getCurrentUser().getUid()).child("chapter").child(subjectId);

    databaseReferenceGetChapter.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            progressBar.setVisibility(View.GONE);

            chapterList.clear();
            for (DataSnapshot courseSnapshot: dataSnapshot.getChildren()){
                Chapter chapter = courseSnapshot.getValue(Chapter.class);
                chapterList.add(chapter);

            }

            ChapterList adapterChapter = new ChapterList(AddQuestion.this,R.layout.list_layout,chapterList);
            spinnerChapter.setAdapter(adapterChapter);
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });[this my realtime data base and i want to access intro to java chapter][1]

0 个答案:

没有答案