'Index only displays 3 first fields, how to add more fields to the index?

I'm trying to add more fields to this index:

enter image description here

As you can see, in the image it only gives me the option of: ID, Processed_Date and Date.

But I want to select: Date, From, Subject, To_Recipients and body.

How can I add those fields to the dropdow in index creation?



Solution 1:[1]

Since you are using the userArrayList variable globally to serve your adapter the data try to remove the LessonPlanAdapter class parameter and just use the global variable to populate it:

inner class LessonPlanAdapter() : RecyclerView.Adapter<LessonPlanAdapter.MyViewHolder>() {

    ...

    override fun getItemCount(): Int = userArrayList.size

    override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
        val currentitem = userArrayList[position]
            
        ...
    }
}

I think that the problem may be related to the fact that the class variable containing the data wasn't updated correctly.

That could have caused an index out of bounds exception when reaching the bottom of the list.

Solution 2:[2]

Solved ! I'm not sure what the problem was but I could solve it by deleting all of the documents that I have in firestore then trying to add new documents. now it's working fine. thank guys for your help !

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lpizzinidev
Solution 2 Phearum