如何在firebase函数android中获取回调

问题描述

我从Firebase集合“ shopping_lists”中检索数据。我将字符串列表传递给它,其中包含firebase ID。现在,在获取数据之后,我想检查我的字符串之一是否与检索到的数据匹配。如果是这样,我将它们添加到shoppinglist对象的arraylist中。 我的问题是,我需要获取包含这些对象的整个列表。但是由于这些firebase函数是异步的,所以在调用它时,我的回调为空。

对于体系结构。我有一个存储库,该存储库处理在活动中调用数据库查询

shoppingListRepositroy.getShoppingLists(acceptedShoppingLists,new ShoppingListRepository.FirebaseCallbackList() {
                        @Override
                        public void onCallback(ArrayList<ShoppingList> shoppingListArrayList) {
                            Log.e("TEST",shoppingListArrayList.toString());
                            //i need to get the list with the shoppinglist objects here to populate the list view on the callback
                            //populateListView();
                            progressBar.setVisibility(View.GONE);
                        }
E/SHOPPING_LIST_REPO: task successful
W/ilecomputingap: Accessing hidden method Lsun/misc/Unsafe;->getobject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist,linking,allowed)
E/SHOPPING_LIST_REPO: task getResults
    check for-loop
    check for-loop
    task getResults
    check for-loop
    check for-loop
    task getResults
    check for-loop
    check for-loop
    task getResults
    check for-loop
    check for-loop
    task getResults
    check for-loop
    check for-loop
    task getResults
    check for-loop
    check for-loop
    onCallback executed
E/TEST: []

我希望你能解决我的问题。如果没有,请随时提出问题。

编辑: 这是输出

static

如您所见,它没有在if循环中执行日志...

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)