Reputation: 2997
That's my code:
public void loadNavigationDrawerItems(){
adapter.notifyDataSetChanged();
adapter.setItems();
//Log.d(TAG, "--> Reload Navigation Drawer");
}
is it correct? or is it better to mod it as this
public void loadNavigationDrawerItems(){
adapter.setItems();
adapter.notifyDataSetChanged();
//Log.d(TAG, "--> Reload Navigation Drawer");
}
setItems is a method of the adapter that can load item in the adapter from an external class... My question is if is better to call the notifyDataSetChanged before or after the setItems. Thanks
Upvotes: 0
Views: 89
Reputation: 6821
After. You call it when the changes have finished happening and not before hand. I'm guessing you are using a custom adapter. So ideally, the setItems()
method should be invoking notifyDataSetChanged()
itself instead of having to rely on it happening externally.
Upvotes: 1