Recyclerview not call onCreateViewHolder
Your getItemCount
method returns 0
. So RecyclerView
never tries to instantiate a view. Make it return something greater than 0
.
for example
@Override
public int getItemCount() {
return data.size();
}
FirestoreRecyclerAdapter not calling onCreateViewHolder
RecylerView Adapter onCreateViewHolder & onBindViewHolder not called: view empty
Try setting the adapter to the RecyclerView earlier on the lifecycle (onCreate is a good choice), and when your AsyncTask is done only notify the adapter via notifyDataSetChanged()
Also, make sure you set a LayoutManager, like this:
recycler.setLayoutManager(new LinearLayoutManager(this));
Since your RecyclerView lives inside the fragment, in your case will be:
recycler.setLayoutManager(new LinearLayoutManager(getActivity()));
Regarding your question
I'm also curious as to what actually triggers the calling of these two
methods on the adapter... if I can figure that out, maybe I can
determine why the event isn't being triggered.
it has to do mostly with your dataset size when the time to render the list arrives. In your case (and once mine), missing to set the LayoutManager, somehow, causes not to render either.
You already have a reference to the context in your adapter, can you try to do:
@Override
public RecyclerViewAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(context).inflate(R.layout.todays_visit_list_item, parent, false); //
RecyclerViewAdapter.MyViewHolder holder = new RecyclerViewAdapter.MyViewHolder(v);
return holder;
}
Recycler adapter doesn't call onCreateViewHolder
The problem was in root layout of activity. It was android.support.constraint.ConstraintLayout. In combination with parameter layout_height"match_parent" of container of fragment it's give that problem. If change ConstraintLayout to any other - it will work properly.
Related Topics
Split Comma Separated Values in Java, Int and String
Iterate Through Each Digit in a Number
Checking If a String Contains a Dot
How to Use Different Jsonproperty on Serialize & Deserialize Using Jackson API
How to Send Text to Textarea in Div Element Using Selenium
How to Call an Excel Vba Macro from Java Code
Spring MVC - Get Httpservletresponse Body
How to Change the Background Color of a Textfield Without Changing the Border in Javafx
How to Test Class Which Implements Runnable With Junit
Password Validate 8 Digits, Contains Upper, Lowercase, and a Special Character
Find Maximum Score or the Maximum Average Score of Candidate Scores Given in Two Dim Array
How to Make a Java Program Quit When "Q" Is Inputted, Issue Is the Default Input Variable Is Double
Reading Data from Nested Json Object Using Java
Scheduling a Job With Spring Programmatically (With Fixedrate Set Dynamically)
Java to Jackson Json Serialization: Money Fields