I\'ve been trying for a while already (as well, searching in here) for something to help me to refresh listView in my MainFragment, when a button is pressed in other fragmen
In MainFragment class you can do the following code:
private static MainFragment instance = null;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
instance = this;
}
public static MainFragment getInstance() {
return instance;
}
And in SocialMedia class you can call the method as follows:
MainFragment.getInstance().otherList();