Firebase List Adapter Constructor error

I created a function to display a chat message, I followed a tutorial, and I also looked at the documentation for the Firebase list adapter, but no matter what I do, I get this error:

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

Here is my code:

private void displayChatMessage() {

    ListView listOfMessage = (ListView)findViewById(;

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

            //Get references to the views of list_item.xml
            TextView messageText, messageUser, messageTime;
            messageText = (TextView) v.findViewById(;
            messageUser = (TextView) v.findViewById(;
            messageTime = (TextView) v.findViewById(;

            messageTime.setText(DateFormat.format("dd-MM-yyyy (HH:mm:ss)", model.getMessageTime()));



The below is implied from FirebaseUI version 3.0+

remove this:

   adapter = new FirebaseListAdapter<ChatMessage>(this,ChatMessage.class,R.layout.list_item,FirebaseDatabase.getInstance().getReference())

you need to add this:

FirebaseListOptions<ChatMessage> options =
            new FirebaseListOptions.Builder<ChatMessage>()
                    .setQuery(query, ChatMessage.class)
 adapter = new FirebaseListAdapter<ChatMessage>(options){

query is the query that you make for the list adapter example:

Query query = FirebaseDatabase.getInstance().getReference().child("chats");

more information here:

Using FirebaseUI to populate a ListView


Firebase token.email_verified going weird

Ok so im making a blog which requires users to login through firebase. To post comments, their email has to be verified

I know how to verify the email, and i did so with my test account. When i typed into the console


it returned true, so yes my email was verified.

But the comment .validate rule requires the user to be validated, like so:

auth.token.email_verified === true

However it wasn’t working, so i removed it and it began to work again

After a bit of reading, I realized that i had to

const credentials = firebase.auth.EmailAuthProvider.credential(, password);

  .then(() => { /* ... */ });

And that makes it work perfectly. The explanation was it apparantly takes the firebase server some time to update its backend validation, but reauthenticating forces the update immediately.

However, I am stumped on how to ask the user to reauthenticate themselves, as i have the following problem

How do I know when the users is validated (firebase.auth().currentUser.emailValidated), and at the same time the firebase backend is not updated (auth.token.email_verified === true is false) so that i can update my UI and prompt the user to reauthenticate

Basically how can i know when auth.token.email_verified === true is not updated yet on the client side

edit also is there a client side solution without reauthentication that updates the backend validation?

edit I tried user.reload().then(() => window.location.replace('/')) but it didnt work


This is what is likely happening:

firebase.auth().currentUser.emailVerified is updated when firebase.auth().currentUser.reload() is called after verification. However auth.token.email_verified gets its value from the ID token which will not get updated until it gets expired or you force refresh. So you may have to call firebase.auth().currentUser.getIdToken(true) to force refresh to update the token claim which is sent to the Firebase Database backend.


How Do I Use setOnFocusChangeListener with RecyclerView?

I have the following on onBindViewHolder() in Adapter Class for RecyclerView:

holder.answerEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                public void onFocusChange(View v, boolean hasFocus) {

                        String answer = holder.answerEditText.getText().toString();



The above only returns input from the first editText in the recyclerview. What could I be doing wrong? I would like it to return text from all EditTexts in the recyclerview.


This happens because of the keyboard which pops up once you click on any Edit box in a recyclerview because onbindview is called and the focus changes to the first box in the recyclerview as all rows are reinflated again.

Hence, monitor for on focus gain and do ur stuff first before keyboard pops up. Hope this helps.


Detecting the previous item in recycler view

I have a model class called (messages). In on bind view holder method of recycler view adapter I do this to extract the (time) string from the (messages) class:

public void onBindViewHolder(final ViewHodler view holder, int position){

  //here I extract the time value from (messages) class

  messages mess=messageslist.get(position);

  //I store it in a long variable called time

  long time= mess.getTime();


Until here I am only getting the time value of each item in recycler view. But I want also to get the time of the previous item and compare it to the next one.

In other words I am trying to find the difference of time between each 2 items in recyclerview.

Thanks for your help.


okay what I want to do is to show or hide a date view if the difference of date between the 2 items reached or passed 1 day. If I do it according to the answers below I get no results…like this

    //the time of the item
    long time= mess.getTime();

     //the time of the previous item according to the answers below

    long pre_time=messageslist.get(position-1).getTime();

     //now I compare the difference 

      if(time - pre_time >= 24*3600*1000){ 

         //show date
         //hide date

but doest work.


Edited the answer based on updated question

You should convert the time milliseconds to DAY_OF_MONTH and check if the day of the current item is greater than the day of the previous item.

Calendar calendar = Calendar.getInstance();

Messages mess = messagesList.get(position);
int date = calendar.get(Calendar.DAY_OF_MONTH);

if (position > 0) {
    Messages previousMessage = messagesList.get(position - 1);
    if (previousMessage != null) {
        int prevDate = calendar.get(Calendar.DAY_OF_MONTH);

        if (date > prevDate) {
            // This is a different day than the previous message, so show the Date
        } else {
            // Same day, so hide the Date

} else {
    // This is the first message, so show the date

Flickity carousel as navigation for another

So, I’m using this

And I activated the prevNextButtons: true, like this:

      prevNextButtons: false,
      wrapAround: false,
      pageDots: false,
      autoPlay: 10000
      asNavFor: '.characters-main',
      cellAlign: 'right',
      prevNextButtons: true,
      contain: true,
      pageDots: false,
      arrowShape: {
        x0: 10,
        x1: 70, y1: 50,
        x2: 70, y2: 50,
        x3: 35

I want that, when I click on the prevNextButtons for .characters-nav to automatically select the element from .characters-main.

This is how it works now:

enter image description here


I have taken Your Example over here and I have added the following code:

 // Main div
    var flkty = new Flickity('.carousel-main');

   // Next and previous events of the navigation div
    $(".carousel-nav .next").on("click", function() {
          // Changing items of the main div

 $(".carousel-nav .previous").on("click", function() {
          // Changing items of the main div

In Your Case it should be like this:

         // Your main div is characters-main
        var flkty = new Flickity('.characters-main');

       // Next and previous events of the characters-nav
        $(".characters-nav .next").on("click", function() {
              // Changing items of the main div

     $(".characters-nav .previous").on("click", function() {
              // Changing items of the main div
Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..