From the activation I call the method in the fragment:

fragmentContact = new FragmentContact(); fragmentContact.dataAdd(name, number, email); 

I add an object to the sheet with the method in the fragment and update the adapter:

 public void dataAdd(String name, String number, String email) { contactsList.add(new Contacts(name, number, email)); Collections.sort(contactsList, new Contacts.SortBeName()); mAdapter.dataChanged(contactsList); } 

Exception in this line:

 contactsList.add(new Contacts(name, number, email)); 
  • 3
    It is logical to assume that contactsList is not initialized - rjhdby
  • one
  • Creating a new instance of the fragment you do not get access to the one that is displayed on the screen. Probably, you still need to refer to the fragment on the screen. If so, then look for it through FragmentManager - YuriySPb

0