F
F
franc21102020-05-13 00:20:20
Java
franc2110, 2020-05-13 00:20:20

How to fix FirebaseListAdapter cannot be applied?

I did a chat based on a video tutorial, but an error popped up - error: constructor FirebaseListAdapter in class FirebaseListAdapter cannot be applied to given types;
adapter= new FirebaseListAdapter(this, Message.class, R.layout.list_item, FirebaseDatabase.getInstance().getReference()) {
required: FirebaseListOptions
found: MainActivity,Class,int,DatabaseReference
reason: actual and formal argument lists differ in length
where T is a type-variable:

5ebb12620850c694229062.png

private void displayAllMessages() {
        ListView listOfMessages = findViewById(R.id.list_of_messages);
        adapter= new FirebaseListAdapter<Message>(this, Message.class, R.layout.list_item, FirebaseDatabase.getInstance().getReference()) {
            @Override
            protected void populateView(View v, Message model, int position) {
                TextView mess_user, mess_time, mess_text;
                mess_user = v.findViewById(R.id.message_user);
                mess_time = v.findViewById(R.id.message_time);
                mess_text = v.findViewById(R.id.message_text);

                mess_user.setText(model.getUserName());
                mess_text.setText(model.getTextMessage());
                mess_time.setText(DateFormat.format("dd-MM-yyyy HH:mm:ss", model.getMessageTime()));
            }
        };
        listOfMessages.setAdapter(adapter);
    }


Help to understand, please.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question