When / How to add a ListView Adapter, that it gets restored with back button?
I want to move back from FragmentB
to Fragment A
and have the same Adapter as I had before going to FragmentB
.
@Override
public void onViewCreated(@NonNull View view, @Nullable final Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
adapter = new UserAdapter(getContext(), R.layout.list_item, userList);
}
With this I am always creating a new one. I just want to create it once and then keep it.