I want to use collectionGroup()
inside a RecyclerView.ViewHolder
to query a subcollection on my FirebaseFirestore
and I get an error saying:
'collectionGroup(java.lang.String)' is not public in 'com.google.firebase.firestore.FirebaseFirestore'. Cannot be accessed from outside package
class WallHolder extends RecyclerView.ViewHolder {
private LinearLayout root, llp, image_layout;
private RelativeLayout rlp;
private TextView comment, tv_due, tv_pass;
private Button btn_play;
private SeekBar seekBar;
private ImageView imageView[] = new ImageView[3];
public WallHolder(@NonNull View itemView) {
super(itemView);
root = itemView.findViewById(R.id.list_root);
llp = root.findViewById(R.id.llp);
rlp = root.findViewById(R.id.rlp);
comment = root.findViewById(R.id.tv_cmt);
image_layout = root.findViewById(R.id.img_layout);
btn_play = llp.findViewById(R.id.btn_play);
tv_due = rlp.findViewById(R.id.tv_due);
tv_pass = rlp.findViewById(R.id.tv_pass);
seekBar = rlp.findViewById(R.id.seek_bar);
imageView[0] = image_layout.findViewById(R.id.img_1);
imageView[1] = image_layout.findViewById(R.id.img_2);
imageView[2] = image_layout.findViewById(R.id.img_3);
}
void setData(final Map<String, Object> post) {
FirebaseFirestore db = FirebaseFirestore.getInstance();
final StorageReference storageRef = FirebaseStorage.getInstance().getReference();
//This is where i get the error
//db.collectionGroup()
//
//This code wasn't working so i want to replace it with the code above
db.collection("Post")
//.document(post.get("post_Id").toString())
.document("mnk2EqrVmm3upTFYL4eB")
.collection("Post_Images")
.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
final List<Bitmap> list = new ArrayList<>();
Toast.makeText(WallActivity.this, String.valueOf(task.getResult().size()), Toast.LENGTH_SHORT).show();
for (QueryDocumentSnapshot document : task.getResult()){
}
} else {
}
}
});
}
}