我想从android列表视图中的firebase实时数据库中检索这些数据。
@Override
protected void onStart() {
super.onStart();
//attaching value event listener
contactsRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
//clearing the previous artist list
videoses.clear();
//iterating through all the nodes
for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
//getting artist
Videos artist = postSnapshot.getValue(Videos.class);
//adding artist to the list
videoses.add(artist);
}
//creating adapter
ArtistList artistAdapter = new ArtistList(MainActivity.this, videoses);
//attaching adapter to the listview
listViewArtists.setAdapter(artistAdapter);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
无法检索视频列表的子数据即。视频1,下载并命名。