No Adapter Attached; Skipping Layout Skipped 1 Till 2 Frames
I have tried looking for the answer but none works but i believe that this code is a problem,debugger says that Here is the link to my file : TodoListApp Skipped 1 frames! The a
Solution 1:
Inside your onCreate:
// Set up your RecyclerView with the appropriate Layout ManagerRecyclerViewmyRecycler= findViewById(R.id.my_recycler_id);
myRecycler.setLayoutManager(newLinearLayoutManager(this));
// Create your data set
myData = newArrayList<MyDataType>();
// Create an instance of your adapter passing the data set into the constructor
myAdapter = newMyAdapter(this, myData);
// Set the Adapter on the RecyclerView directly within onCreate// so that it doesn't get skipped
myRecycler.setAdapter(myAdapter);
Inside your Event Listener callback:
@OverridepublicvoidonDataChange(DataSnapshot snapshot){
// Add the new data to your data set ex. myData.add(newData)// ...// After adding to the data set,// update the data using a custom function you define in your Adapter's class
myAdapter.updateData(myData);
}
Inside your Adapter class, create a function to update your Adapter's data set:
publicvoidupdateData(ArrayList<MyDataType> newDataSet){
myAdapterDataSet = newDataSet;
// Let the Adapter know the data has changed and the view should be refreshednotifyDataSetChanged();
}
Post a Comment for "No Adapter Attached; Skipping Layout Skipped 1 Till 2 Frames"