我最近开始使用Firestore进行开发,并且所附加的方法存在以下问题。
public void PopulateList() {
_db = FirebaseFirestore.getInstance();
if (new Networks( _activity ).verficaConexion()){
storeRoomArrayList = new ArrayList <>();
_db.collection( Colections.StoreRoom.NOMBRECOLECCION )
.get()
.addOnCompleteListener( new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task <QuerySnapshot> task) {
if (task.isSuccessful()){
for (QueryDocumentSnapshot document : task.getResult()) {
String claveRepuesto = document.getData().get( Colections.StoreRoom.CLAVEREPUESTO ).toString();
String descripcion = document.getData().get( Colections.StoreRoom.DESCRIPCION ).toString();
String familia = document.getData().get( Colections.StoreRoom.FAMILIA ).toString();
String idFamilia = document.getData().get( Colections.StoreRoom.IDFAMILIA ).toString();
String idSubFamilia = document.getData().get( Colections.StoreRoom.IDSUBFAMILIA ).toString();
String interno = document.getData().get( Colections.StoreRoom.INTERNO ).toString();
String marca = document.getData().get( Colections.StoreRoom.MARCA ).toString();
String nroParte = document.getData().get( Colections.StoreRoom.NUMERODEPARTE ).toString();
String nroSerie = document.getData().get( Colections.StoreRoom.NUMERODESERIE ).toString();
String subFamilia = document.getData().get( Colections.StoreRoom.SUBFAMILIA ).toString();
String uniMedida = document.getData().get( Colections.StoreRoom.UMEDIDA ).toString();
storeRoomArrayList.add( new StoreRoom( claveRepuesto, descripcion,
familia, idFamilia, idSubFamilia, interno, marca, nroParte,
nroSerie, subFamilia, uniMedida ) );
}
InitRecyclerView(storeRoomArrayList);
} else{
Log.d("CargoListaStoreRoom", "Error getting documents: ", task.getException());
}
}
});
}else{
Snackbar.make( this._progressBar, "Error Conexion", Snackbar.LENGTH_LONG ).show();
}
}
我不知道为什么在方法行“ .get.addOnCompleteListener”中退出而不输入“ onComplete”。 这种方法不是我唯一的方法。我有另一个类似这样的例程,但是一切正常。
我遇到麻烦的Firestore集合: