小编dsa*_*ali的帖子

Firebase列表适配器构造函数错误

我创建了一个显示聊天消息的函数,我按照教程,我还查看了Firebase列表适配器的文档,但无论我做什么,我都会收到此错误:

Error:(98, 19) error: constructor FirebaseListAdapter in class 
FirebaseListAdapter<T> cannot be applied to given types; 
required: FirebaseListOptions<ChatMessage>
found: Chat,Class<ChatMessage>,int,DatabaseReference
reason: actual and formal argument lists differ in length
where T is a type-variable:
T extends Object declared in class FirebaseListAdapter
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

private void displayChatMessage() {

    ListView listOfMessage = (ListView)findViewById(R.id.list_of_messages);

    FirebaseRecyclerOptions<ChatMessage> options =
            new FirebaseRecyclerOptions.Builder<ChatMessage>()
                    .setQuery(query, ChatMessage.class)
                    .build();
    adapter = new FirebaseListAdapter<ChatMessage, Holder>(options){
        @Override
        protected void populateView(View v, ChatMessage model, int position) {

            //Get references to the views of list_item.xml
            TextView …
Run Code Online (Sandbox Code Playgroud)

java android firebase firebase-realtime-database firebaseui

5
推荐指数
1
解决办法
2632
查看次数