Android-E / RecyclerView:未连接适配器;跳过布局

时间:2020-01-15 05:05:25

标签: android firebase firebase-realtime-database

我正在尝试在我的应用程序中实现回收站视图,但出现上述错误。好像我没有将适配器设置在正确的位置。

为了给您一个概览,我需要根据另一个查询的结果搜索数据库,因此我在MainActivity.class内创建了一个方法CompanyName LastSale (Notes note returned in the result) ABC123 01/15/2016 (Max(SaleDate) LastSale for ID=1) CDE456 03/21/2017 (Max(SaleDate) LastSale for ID=2) EFG789 05/27/2018 (Max(SaleDate) LastSale for ID=3) Testing456 10/11/2018 (Max(SaleDate) LastSale for ID=5) ID=4 & ID=6 are note returned because IsActive = 0 for these records. 来以字符串格式推出查询结果populateViews(query)

我检查了日志,似乎代码正在进入populateView方法,但找不到适配器。

onDataChanged()方法类似于:

populateView

编辑:添加了布局管理器,但仍然出现相同的错误。

1 个答案:

答案 0 :(得分:0)

在连接适配器之前,您需要设置layoutmanager。以下是layoutmanager的示例,可帮助以垂直方式填充数据。

LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
menuRecyclerView.setLayoutManager(linearLayoutManager);
相关问题